diff options
author | thomascube <thomas@roundcube.net> | 2011-10-18 10:09:32 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2011-10-18 10:09:32 +0000 |
commit | dfc79b341c4ae80fe3bae0c52cadee7c28a108fd (patch) | |
tree | e64c8e19f3a5f5556db884e5f36db1ab6453d761 /program/include/rcube_imap.php | |
parent | 54b0d86aad28e67c07644a81e6917f1f53581d25 (diff) |
Find charset in HTML meta tags if not specified in content-type header (#1488125)
Diffstat (limited to 'program/include/rcube_imap.php')
-rw-r--r-- | program/include/rcube_imap.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index 8dfffe828..c35c877e6 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -2396,7 +2396,11 @@ class rcube_imap if (!$skip_charset_conv) { if (!$o_part->charset || strtoupper($o_part->charset) == 'US-ASCII') { - $o_part->charset = $this->default_charset; + // try to extract charset information from HTML meta tag (#1488125) + if ($o_part->ctype_secondary == 'html' && preg_match('/<meta[^>]+charset=([a-z0-9-]+)/i', $body, $m)) + $o_part->charset = strtoupper($m[1]); + else + $o_part->charset = $this->default_charset; } $body = rcube_charset_convert($body, $o_part->charset); } |