mirror of
https://github.com/retailcrm/Fetch.git
synced 2024-11-23 11:36:02 +03:00
add ability to support alternative charset names
This commit is contained in:
parent
29de2a7458
commit
dfd4cbeda0
@ -191,6 +191,10 @@ class Message
|
|||||||
*/
|
*/
|
||||||
public static $charsetFlag = '//TRANSLIT';
|
public static $charsetFlag = '//TRANSLIT';
|
||||||
|
|
||||||
|
public static $charsetRenames = array(
|
||||||
|
'ks_c_5601-1987' => 'CP949',
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These constants can be used to easily access available flags
|
* These constants can be used to easily access available flags
|
||||||
*/
|
*/
|
||||||
@ -576,6 +580,10 @@ class Message
|
|||||||
$from = strtolower($from);
|
$from = strtolower($from);
|
||||||
$to = strtolower($to);
|
$to = strtolower($to);
|
||||||
|
|
||||||
|
if (isset(self::$charsetRenames[$from])) {
|
||||||
|
$from = self::$charsetRenames[$from];
|
||||||
|
}
|
||||||
|
|
||||||
if ($from === $to) {
|
if ($from === $to) {
|
||||||
if ($to === 'utf-8') {
|
if ($to === 'utf-8') {
|
||||||
return UTF8::fix($text);
|
return UTF8::fix($text);
|
||||||
|
@ -42,6 +42,12 @@ class MIMETest extends \PHPUnit_Framework_TestCase
|
|||||||
'?????? ?????.pdf',
|
'?????? ?????.pdf',
|
||||||
'=?UTF-8?B?' .base64_encode("\xCF\xF0\xE8\xEC\xE5\xF0 \xEF\xEB\xE0\xED\xE0\x2E\x70\x64\x66") . '?=',
|
'=?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?=',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user