From 135a4f6501274716c32bfc3cbe2f500528c0b5b6 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Thu, 10 Nov 2011 15:07:38 +0000 Subject: [PATCH] handle utf-16 plain text attachments --- felamimail/inc/class.felamimail_bo.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/felamimail/inc/class.felamimail_bo.inc.php b/felamimail/inc/class.felamimail_bo.inc.php index 5aed61bc57..016cab1cc4 100644 --- a/felamimail/inc/class.felamimail_bo.inc.php +++ b/felamimail/inc/class.felamimail_bo.inc.php @@ -1476,7 +1476,6 @@ class felamimail_bo 'attachment' =>__METHOD__.' failed:'.$attachment->message ); } - switch ($structure->encoding) { case 'BASE64': // use imap_base64 to decode @@ -1490,6 +1489,10 @@ class felamimail_bo default: // it is either not encoded or we don't know about it } + if ($structure->type === 'TEXT' && isset($structure->parameters['CHARSET']) && stripos('UTF-16',$structure->parameters['CHARSET'])!==false) + { + $attachment = mb_convert_encoding($attachment,self::$displayCharset,$structure->parameters['CHARSET']); + } $attachmentData = array( 'type' => $structure->type .'/'. $structure->subType,