improving decode_header for charset x-unknown and encoding Base64

This commit is contained in:
Klaus Leithoff 2009-09-08 13:26:47 +00:00
parent 90ff141ed7
commit cc143b76a2

View File

@ -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';
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))