Ticket #1484961: rcube_imap.patch
| File rcube_imap.patch, 1.9 KB (added by alec, 17 months ago) |
|---|
-
rcube_imap.php
1337 1336 if ($o_part->ctype_primary=='text' || $o_part->ctype_primary=='message') 1338 1337 { 1339 1338 // assume default if no charset specified 1340 if (empty($o_part->charset) )1341 $o_part->charset = $this->default_charset;1339 if (empty($o_part->charset) || preg_match('/us-ascii|x-unknown/i', $o_part->charset)) 1340 $o_part->charset = rc_detect_encoding(substr($body, 0, 10000), $this->default_charset); 1342 1341 1343 1342 $body = rcube_charset_convert($body, $o_part->charset); 1344 1343 } … … 1364 1363 function &get_body($uid, $part=1) 1365 1364 { 1366 1365 $headers = $this->get_headers($uid); 1367 return rcube_charset_convert(1368 $this->mime_decode($this->get_message_part($uid, $part), 'quoted-printable'),1369 $headers->charset ? $headers->charset : $this->default_charset);1366 $body = $this->mime_decode($this->get_message_part($uid, $part), 'quoted-printable'); 1367 return rcube_charset_convert($body, $headers->charset ? $headers->charset 1368 : rc_detect_encoding(substr($body, 0, 10000), $this->default_charset)); 1370 1369 } 1371 1370 1372 1371 … … 2434 2433 */ 2435 2434 function decode_header($input, $remove_quotes=FALSE) 2436 2435 { 2437 $str = rcube_imap::decode_mime_string((string)$input, $this->default_charset);2436 $str = rcube_imap::decode_mime_string((string)$input, rc_detect_encoding($input)); 2438 2437 if ($str{0}=='"' && $remove_quotes) 2439 2438 $str = str_replace('"', '', $str); 2440 2439 … … 2571 2570 return rcube_charset_convert($body, $ctype_param['charset']); 2572 2571 2573 2572 // defaults to what is specified in the class header 2574 return rcube_charset_convert($body, $this->default_charset);2573 return rcube_charset_convert($body, rc_detect_encoding(substr($body, 0, 10000), $this->default_charset)); 2575 2574 } 2576 2575 2577 2576
