From cc143b76a220156f67d236fe86a4f57926711241 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 8 Sep 2009 13:26:47 +0000 Subject: [PATCH] improving decode_header for charset x-unknown and encoding Base64 --- phpgwapi/inc/class.translation.inc.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/phpgwapi/inc/class.translation.inc.php b/phpgwapi/inc/class.translation.inc.php index 7479271152..1ddac77d1f 100644 --- a/phpgwapi/inc/class.translation.inc.php +++ b/phpgwapi/inc/class.translation.inc.php @@ -953,13 +953,21 @@ class translation $string = preg_replace('/\?=\s+=\?/', '?= =?', $_string); $elements=imap_mime_header_decode($string); - + $convertAtEnd = false; foreach((array)$elements as $element) { if ($element->charset == 'default') $element->charset = 'iso-8859-1'; - - $newString .= self::convert($element->text,$element->charset); + if ($element->charset != 'x-unknown') + { + $newString .= self::convert($element->text,$element->charset); + } + else + { + $newString .= $element->text; + $convertAtEnd = true; + } } + if ($convertAtEnd) $newString = self::decodeMailHeader($newString,$displayCharset); return preg_replace('/([\000-\012\015\016\020-\037\075])/','',$newString); } elseif(function_exists(mb_decode_mimeheader))