Author Topic: seems not fully support ie7 & found a bug in sendmail's From: field  (Read 1850 times)

Offline bigfaucet

  • Newbie
  • *
  • Posts: 3
roundcube version 0.1 Beta 2

1. search box not shown correctly in ie 7



2. spellcheck not work in ie7
It's correctly worked in the same machine with firefox, or an ie6, but ie7 got the error as below, and no error log can be found in logs/error



3. if user setup his identify in "personal setting" with a name. the "From:" filed not correctly encoded. I used chinese name.
below is the From field in mail source encoded with roundcube
Code: [Select]
From: =?UTF-8?Q?=E4=B8=81=E5=8F=AF=20 <user@mydomain.com>?=
in fact it should be
Code: [Select]
From: =?UTF-8?Q?=E4=B8=81=E5=8F=AF=20?=
I add a small patch to fix that in the file MAILROOT/program/lib/Mail/mime.php
in function _encodeHeaders, iconv_mime_encode will always encode From field like
Code: [Select]
From: =?UTF-8?Q?=E4=B8=81=E5=8F=AF=20 <user@mydomain.com>?=I modify it as below, it works
Code: [Select]
function _encodeHeaders($input)
  {
    foreach ($input as $hdr_name => $hdr_value) {
      if (function_exists('iconv_mime_encode') && preg_match('#[\x80-\xFF]{1}#', $hdr_value)){
      //trigger_error($hdr_name."|".$hdr_value);
     
        $imePref = array();
        if ($this->_build_params['head_encoding'] == 'base64'){
          $imePrefs['scheme'] = 'B';
        }else{
          $imePrefs['scheme'] = 'Q';
        }
        $imePrefs['input-charset'] = $this->_build_params['head_charset'];
        $imePrefs['output-charset'] = $this->_build_params['head_charset'];
        if(strcmp($hdr_name, 'From') == 0 && preg_match("/^([^\<\>]+)(<.*@.*>)/i", $hdr_value, $matches) == 1) {
        $imePrefs['input-charset'] = 'UTF-8'; //it should be set to backend database's character set
          $hdr_value = iconv_mime_encode($hdr_name, $matches[1], $imePrefs).$matches[2];
        } else {
        $hdr_value = iconv_mime_encode($hdr_name, $hdr_value, $imePrefs);
        }