summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorestadtherr <estadtherr@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-07-31 02:57:53 +0000
committerestadtherr <estadtherr@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-07-31 02:57:53 +0000
commitf75a81c26c504fb50757936df9df5022e32ccc06 (patch)
tree70a7f5ab4dffb8fefef6bb516369e4fb527d81ed
parentae03a81c881d70be93c26b338bbabbc1b32baf41 (diff)
better solution for HTML washing encoding issue
git-svn-id: https://svn.roundcube.net/trunk@2815 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--roundcubemail/CHANGELOG2
-rw-r--r--roundcubemail/program/steps/mail/func.inc14
2 files changed, 8 insertions, 8 deletions
diff --git a/roundcubemail/CHANGELOG b/roundcubemail/CHANGELOG
index 673f8f925..420c5920c 100644
--- a/roundcubemail/CHANGELOG
+++ b/roundcubemail/CHANGELOG
@@ -1,12 +1,12 @@
CHANGELOG RoundCube Webmail
===========================
+- Fix HTML washing to respect character encoding
- Fix endless loop in iil_C_Login() with Courier IMAP (#1486010)
- Fix #messagemenu display on IE (#1486006)
- Speedup UI by using sprites for (toolbar) buttons
- Fix charset names with X- prefix handling
- Fix displaying of HTML messages with unknown/malformed tags (#1486003)
-- Fix HTML washing of non-UTF8 messages
RELEASE 0.3-RC1
---------------
diff --git a/roundcubemail/program/steps/mail/func.inc b/roundcubemail/program/steps/mail/func.inc
index 9928cb150..2a301ae17 100644
--- a/roundcubemail/program/steps/mail/func.inc
+++ b/roundcubemail/program/steps/mail/func.inc
@@ -685,17 +685,17 @@ function rcmail_wash_html($html, $p = array(), $cid_replaces)
// fix (unknown/malformed) HTML tags before "wash"
$html = preg_replace_callback('/(<[\/!]*)([^ >]+)/', 'rcmail_html_tag_callback', $html);
- // charset was converted to UTF-8 in rcube_imap::get_message_part() -> change charset specification in HTML accordingly
+ // charset was converted to UTF-8 in rcube_imap::get_message_part(),
+ // change charset specification in HTML accordingly
$charset_pattern = '/(\s+content=[\'"]?\w+\/\w+;\s*charset)=([a-z0-9-_]+)/i';
if (preg_match($charset_pattern, $html)) {
$html = preg_replace($charset_pattern, '\\1='.RCMAIL_CHARSET, $html);
- } else {
- // add head for malformed messages, washtml cannot work without that
- if (!preg_match('/<head[^>]*>(.*)<\/head>/Uims', $html))
- $html = '<head></head>'. $html;
- $html = substr_replace($html, '<meta http-equiv="content-type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '<head>')+6), 0);
}
-
+ // add head for malformed messages, washtml cannot work without that
+ if (!preg_match('/<head[^>]*>(.*)<\/head>/Uims', $html))
+ $html = '<head></head>'. $html;
+ $html = substr_replace($html, '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '<head>')+6), 0);
+
// turn relative into absolute urls
$html = rcmail_resolve_base($html);