Commit eb0061f7 authored by YANO Takashi's avatar YANO Takashi

ZP-1202 Part of subject or from may be in junk string. Released under the...

ZP-1202 Part of subject or from may be in junk string. Released under the Affero GNU General Public License (AGPL) version 3.
parent 20b2f819
......@@ -1192,10 +1192,20 @@ class Utils {
return $utf8str;
}
$isiso2022jp = false;
$issamecharset = true;
$charset = NULL;
$str = "";
$striso2022jp = "";
foreach ( @imap_mime_header_decode($nonencstr) as $val ) {
if ( is_null($charset) ) {
$charset = strtolower($val->charset);
}
if ( $charset != strtolower($val->charset) ) {
$issamecharset = false;
}
if ( strtolower($val->charset) == "iso-2022-jp" ) {
$isiso2022jp = true;
$striso2022jp .= $val->text;
$str .= @mb_convert_encoding($val->text, "utf-8", "ISO-2022-JP-MS");
} else if ( strtolower($val->charset) == "default" ) {
$str .= $val->text;
......@@ -1206,6 +1216,9 @@ class Utils {
if ( !$isiso2022jp ) {
return $utf8str;
}
if ( $charset == 'iso-2022-jp' && $issamecharset ) {
$str = @mb_convert_encoding($striso2022jp, "utf-8", "ISO-2022-JP-MS");
}
return $str;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment