diff -ur roundcube.r955/config/main.inc.php.dist roundcube/config/main.inc.php.dist
|
old
|
new
|
|
| 120 | 120 | // the default locale setting |
| 121 | 121 | $rcmail_config['locale_string'] = 'en'; |
| 122 | 122 | |
| | 123 | // the default locale charset |
| | 124 | $rcmail_config['locale_charset'] = 'ISO-8859-1'; |
| | 125 | |
| 123 | 126 | // use this format for short date display |
| 124 | 127 | $rcmail_config['date_short'] = 'D H:i'; |
| 125 | 128 | |
diff -ur roundcube.r955/program/include/main.inc roundcube/program/include/main.inc
|
old
|
new
|
|
| 126 | 126 | */ |
| 127 | 127 | function rcmail_load_config() |
| 128 | 128 | { |
| 129 | | global $INSTALL_PATH; |
| | 129 | global $INSTALL_PATH, $utf8_maps; |
| 130 | 130 | |
| 131 | 131 | // load config file |
| 132 | 132 | include_once('config/main.inc.php'); |
| … |
… |
|
| 141 | 141 | include_once('config/db.inc.php'); |
| 142 | 142 | $conf = array_merge($conf, $rcmail_config); |
| 143 | 143 | |
| | 144 | if (empty($conf['locale_charset'])) |
| | 145 | $conf['locale_charset'] = 'ISO-8859-1'; |
| | 146 | |
| | 147 | $utf8_maps['KOI8-R'] = UTF8_MAP_DIR . "/KOI8R.map"; |
| | 148 | $utf8_maps['KOI8_R'] = UTF8_MAP_DIR . "/KOI8R.map"; |
| | 149 | $utf8_maps['KOI8R'] = UTF8_MAP_DIR . "/KOI8R.map"; |
| | 150 | |
| 144 | 151 | if (empty($conf['log_dir'])) |
| 145 | 152 | $conf['log_dir'] = $INSTALL_PATH.'logs'; |
| 146 | 153 | else |
| … |
… |
|
| 255 | 262 | $IMAP = new rcube_imap($DB); |
| 256 | 263 | $IMAP->debug_level = $CONFIG['debug_level']; |
| 257 | 264 | $IMAP->skip_deleted = $CONFIG['skip_deleted']; |
| | 265 | $IMAP->setDefaultCharset($CONFIG['locale_charset']); |
| 258 | 266 | |
| 259 | 267 | |
| 260 | 268 | // connect with stored session data |
| … |
… |
|
| 901 | 909 | */ |
| 902 | 910 | function rcube_charset_convert($str, $from, $to=NULL) |
| 903 | 911 | { |
| 904 | | global $MBSTRING; |
| | 912 | global $MBSTRING, $CONFIG; |
| 905 | 913 | |
| 906 | 914 | $from = strtoupper($from); |
| 907 | 915 | $to = $to==NULL ? strtoupper(RCMAIL_CHARSET) : strtoupper($to); |
| … |
… |
|
| 926 | 934 | return $out; |
| 927 | 935 | } |
| 928 | 936 | |
| 929 | | $conv = new utf8(); |
| | 937 | $conv = new utf8($CONFIG['locale_charset']); |
| 930 | 938 | |
| 931 | 939 | // convert string to UTF-8 |
| 932 | 940 | if ($from=='UTF-7') |
diff -ur roundcube.r955/program/include/rcube_imap.inc roundcube/program/include/rcube_imap.inc
|
old
|
new
|
|
| 66 | 66 | var $search_charset = ''; |
| 67 | 67 | var $debug_level = 1; |
| 68 | 68 | var $error_code = 0; |
| | 69 | var $charset = ''; |
| | 70 | static $default_charset = 'ISO-8859-1'; |
| 69 | 71 | |
| 70 | 72 | |
| 71 | 73 | /** |
| … |
… |
|
| 78 | 80 | $this->db = $db_conn; |
| 79 | 81 | } |
| 80 | 82 | |
| | 83 | function setCharset($charset) { |
| | 84 | if(!empty($charset)) $this->charset = $charset; |
| | 85 | else $this->charset = rcube_imap::$default_charset; |
| | 86 | } |
| | 87 | |
| | 88 | function setDefaultCharset($charset) { |
| | 89 | rcube_imap::$default_charset = $charset; |
| | 90 | $this->setCharset($charset); |
| | 91 | } |
| 81 | 92 | |
| 82 | 93 | /** |
| 83 | 94 | * PHP 4 object constructor |
| … |
… |
|
| 889 | 900 | $results = $this->_search_index($mailbox, $search); |
| 890 | 901 | |
| 891 | 902 | // try search with ISO charset (should be supported by server) |
| 892 | | if (empty($results) && !empty($charset) && $charset!='ISO-8859-1') |
| 893 | | $results = $this->search($mbox_name, $criteria, rcube_charset_convert($str, $charset, 'ISO-8859-1'), 'ISO-8859-1'); |
| | 903 | if (empty($results) && !empty($charset) && $charset!=$this->charset) |
| | 904 | $results = $this->search($mbox_name, $criteria, rcube_charset_convert($str, $charset, $this->charset), $this->charset); |
| 894 | 905 | |
| 895 | 906 | $this->set_search_set($criteria, $str, $results, $charset); |
| 896 | 907 | return $results; |
| … |
… |
|
| 1227 | 1238 | // convert charset (if text or message part) |
| 1228 | 1239 | if ($o_part->ctype_primary=='text' || $o_part->ctype_primary=='message') |
| 1229 | 1240 | { |
| 1230 | | // assume ISO-8859-1 if no charset specified |
| | 1241 | // assume default locale charset if no charset specified |
| 1231 | 1242 | if (empty($o_part->charset)) |
| 1232 | | $o_part->charset = 'ISO-8859-1'; |
| | 1243 | $o_part->charset = $this->charset; |
| 1233 | 1244 | |
| 1234 | 1245 | $body = rcube_charset_convert($body, $o_part->charset); |
| 1235 | 1246 | } |
| … |
… |
|
| 2279 | 2290 | */ |
| 2280 | 2291 | function decode_header($input, $remove_quotes=FALSE) |
| 2281 | 2292 | { |
| 2282 | | $str = $this->decode_mime_string((string)$input); |
| | 2293 | $str = $this->decode_mime_string((string)$input, !empty($this->charset) ? $this->charset : null ); |
| 2283 | 2294 | if ($str{0}=='"' && $remove_quotes) |
| 2284 | 2295 | $str = str_replace('"', '', $str); |
| 2285 | 2296 | |
| … |
… |
|
| 2318 | 2329 | } |
| 2319 | 2330 | |
| 2320 | 2331 | // no encoding information, use fallback |
| 2321 | | return rcube_charset_convert($input, !empty($fallback) ? $fallback : 'ISO-8859-1'); |
| | 2332 | return rcube_charset_convert($input, !empty($fallback) ? $fallback : rcube_imap::$default_charset ); |
| 2322 | 2333 | } |
| 2323 | 2334 | |
| 2324 | 2335 | |
diff -ur roundcube.r955/program/steps/mail/func.inc roundcube/program/steps/mail/func.inc
|
old
|
new
|
|
| 229 | 229 | |
| 230 | 230 | $out .= sprintf("<td class=\"icon\">%s</td>\n", $message_icon ? sprintf($image_tag, $skin_path, $message_icon, '') : ''); |
| 231 | 231 | |
| | 232 | $IMAP->setCharset($header->charset); |
| | 233 | |
| 232 | 234 | // format each col |
| 233 | 235 | foreach ($a_show_cols as $col) |
| 234 | 236 | { |
| … |
… |
|
| 317 | 319 | if (empty($header)) |
| 318 | 320 | continue; |
| 319 | 321 | |
| | 322 | $IMAP->setCharset($header->charset); |
| | 323 | |
| 320 | 324 | // format each col; similar as in rcmail_message_list() |
| 321 | 325 | foreach ($a_show_cols as $col) |
| 322 | 326 | { |
| … |
… |
|
| 815 | 819 | |
| 816 | 820 | $header_count = 0; |
| 817 | 821 | |
| | 822 | $IMAP->setCharset($headers['charset']); |
| | 823 | |
| 818 | 824 | // allow the following attributes to be added to the <table> tag |
| 819 | 825 | $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary')); |
| 820 | 826 | $out = '<table' . $attrib_str . ">\n"; |