diff --git a/include/class.format.php b/include/class.format.php index 4bf497b7a4cecde7c0f8231f024b32f17f0cb3a6..bbacfd68dbedc5067e9886d6e58f35272257e0ab 100644 --- a/include/class.format.php +++ b/include/class.format.php @@ -43,6 +43,11 @@ class Format { } function mimedecode($text, $encoding='UTF-8') { + // Handle poorly or completely un-encoded header values ( + if (function_exists('mb_detect_encoding')) + if (($src_enc = mb_detect_encoding($text)) + && (strcasecmp($src_enc, 'ASCII') !== 0)) + return Charset::transcode($text, $src_enc, $encoding); if(function_exists('imap_mime_header_decode') && ($parts = imap_mime_header_decode($text))) {