From 80329c42f93ad904695741a5e7554838ef2a9eee Mon Sep 17 00:00:00 2001 From: thomasb Date: Tue, 18 Oct 2011 10:09:32 +0000 Subject: Find charset in HTML meta tags if not specified in content-type header (#1488125) git-svn-id: https://svn.roundcube.net/trunk@5341 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/include/rcube_imap.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'roundcubemail/program/include') diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php index 8dfffe828..c35c877e6 100644 --- a/roundcubemail/program/include/rcube_imap.php +++ b/roundcubemail/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('/]+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); } -- cgit v1.2.3