mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 07:09:20 +01:00
some additional stuff to improve mailheader decoding
This commit is contained in:
parent
82455c87a6
commit
82cb36ff3a
@ -985,17 +985,35 @@ class translation
|
||||
//error_log(__FILE__.','.__METHOD__.':'."called with $_string and CHARSET $displayCharset");
|
||||
if(function_exists(imap_mime_header_decode))
|
||||
{
|
||||
// some characterreplacements, as they fail to translate
|
||||
$sar = array(
|
||||
'@(\x84|\x93|\x94)@',
|
||||
'@(\x96|\x97)@',
|
||||
'@(\x91|\x92)@',
|
||||
'@(\x85)@',
|
||||
'@(\x86)@',
|
||||
);
|
||||
$rar = array(
|
||||
'"',
|
||||
'-',
|
||||
'\'',
|
||||
'...',
|
||||
'+',
|
||||
);
|
||||
|
||||
$newString = '';
|
||||
|
||||
$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')
|
||||
{
|
||||
if( strtoupper($element->charset) != 'UTF-8') $element->text = preg_replace($sar,$rar,$element->text);
|
||||
$newString .= self::convert($element->text,$element->charset);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user