add ability to support alternative charset names

This commit is contained in:
Sergey Linnik 2019-03-27 19:30:46 +03:00
parent 29de2a7458
commit dfd4cbeda0
2 changed files with 14 additions and 0 deletions

View File

@ -191,6 +191,10 @@ class Message
*/
public static $charsetFlag = '//TRANSLIT';
public static $charsetRenames = array(
'ks_c_5601-1987' => 'CP949',
);
/**
* These constants can be used to easily access available flags
*/
@ -576,6 +580,10 @@ class Message
$from = strtolower($from);
$to = strtolower($to);
if (isset(self::$charsetRenames[$from])) {
$from = self::$charsetRenames[$from];
}
if ($from === $to) {
if ($to === 'utf-8') {
return UTF8::fix($text);

View File

@ -42,6 +42,12 @@ class MIMETest extends \PHPUnit_Framework_TestCase
'?????? ?????.pdf',
'=?UTF-8?B?' .base64_encode("\xCF\xF0\xE8\xEC\xE5\xF0 \xEF\xEB\xE0\xED\xE0\x2E\x70\x64\x66") . '?=',
),
array(
' (ИСТРЕБИТЕЛЬ ЛЕТАЮЩИХ НАСЕКОМЫХ "БАРГУЗИН" КП ДИЛЕР - 2019г)',
' =?ks_c_5601-1987?B?ICisqqyzrLSssqymrKKsqqy0rKasray+IKytrKastKyhrMCsu6yq?=' .
' =?ks_c_5601-1987?B?rLcgrK+soayzrKasrKywrK6svay3ICKsoqyhrLKspKy1?=' .
' =?ks_c_5601-1987?B?rKmsqqyvIiCsrKyxIKylrKqsraymrLIgLSAyMDE5rNQp?=',
),
);
}