Commit fa86299f authored by YANO Takashi's avatar YANO Takashi

ZP-1172 Some mails bodies or headers in Japanese may be decoded in wrong...

ZP-1172 Some mails bodies or headers in Japanese may be decoded in wrong encoding. Released under the Affero GNU General Public License (AGPL) version 3.
parent 467fb67b
......@@ -142,6 +142,11 @@ function change_charset_and_add_subparts(&$email, $part) {
$new_part = null;
if (isset($part->ctype_parameters['charset'])) {
$part->ctype_parameters['charset'] = 'UTF-8';
if ( isset($part->body) && strpos($part->body, chr(0x1b).'$B') !== false ) {
$part->body = mb_convert_encoding($part->body, "utf-8", "ISO-2022-JP-MS");
}
$new_part = add_sub_part($email, $part);
}
else {
......@@ -233,6 +238,10 @@ function build_mime_message($message) {
}
}
if ( isset($message->body) && strpos($message->body, chr(0x1b).'$B') !== false ) {
$message->body = mb_convert_encoding($message->body, "utf-8", "ISO-2022-JP-MS");
}
$finalEmail = new Mail_mimePart(isset($message->body) ? $message->body : "", $mimeHeaders);
unset($mimeHeaders);
......
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