mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-20 09:58:04 +02: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");
|
//error_log(__FILE__.','.__METHOD__.':'."called with $_string and CHARSET $displayCharset");
|
||||||
if(function_exists(imap_mime_header_decode))
|
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 = '';
|
$newString = '';
|
||||||
|
|
||||||
$string = preg_replace('/\?=\s+=\?/', '?= =?', $_string);
|
$string = preg_replace('/\?=\s+=\?/', '?= =?', $_string);
|
||||||
|
|
||||||
$elements=imap_mime_header_decode($string);
|
$elements=imap_mime_header_decode($string);
|
||||||
|
|
||||||
$convertAtEnd = false;
|
$convertAtEnd = false;
|
||||||
foreach((array)$elements as $element)
|
foreach((array)$elements as $element)
|
||||||
{
|
{
|
||||||
if ($element->charset == 'default') $element->charset = 'iso-8859-1';
|
if ($element->charset == 'default') $element->charset = 'iso-8859-1';
|
||||||
if ($element->charset != 'x-unknown')
|
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);
|
$newString .= self::convert($element->text,$element->charset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user