diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-08-29 09:22:07 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-08-29 09:46:40 +0200 |
commit | d3c2fbf2d6d65f3d990d6b74eb2fc04ccea810b1 (patch) | |
tree | 67c44779f120542309b422b9bb5b017501f88542 | |
parent | 2b41a0e07efadd9374115a7fef96d06cb8f41b39 (diff) |
Fix decoding of HTML messages with UTF-16 charset specified (#1488654)
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | program/include/rcube_charset.php | 6 |
2 files changed, 7 insertions, 0 deletions
@@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix decoding of HTML messages with UTF-16 charset specified (#1488654) - Fix quota capability detection so it can be overwritten by a plugin (#1488655) - Fix identity selection on reply (#1488101) - Fix Larry's messages list filter in IE (#1488632) diff --git a/program/include/rcube_charset.php b/program/include/rcube_charset.php index 7e8fe4997..fc1685d28 100644 --- a/program/include/rcube_charset.php +++ b/program/include/rcube_charset.php @@ -185,6 +185,12 @@ class rcube_charset $to = empty($to) ? strtoupper(RCMAIL_CHARSET) : self::parse($to); $from = self::parse($from); + // It is a common case when UTF-16 charset is used with US-ASCII content (#1488654) + // In that case we can just skip the conversion (use UTF-8) + if ($from == 'UTF-16' && !preg_match('/[^\x00-\x7F]/', $str)) { + $from = 'UTF-8'; + } + if ($from == $to || empty($str) || empty($from)) { return $str; } |