fix NormalizeCharset function

This commit is contained in:
RainLoop Team 2013-12-28 15:09:53 +04:00
parent 25f9a1e95b
commit 2b626afb8b
2 changed files with 21 additions and 9 deletions

View file

@ -522,6 +522,7 @@ class Message
\MailSo\Base\DateTimeHelper::ParseInternalDateString($sInternalDate);
$sCharset = $oBodyStructure ? $oBodyStructure->SearchCharset() : '';
$sCharset = \MailSo\Base\Utils::NormalizeCharset($sCharset);
$sHeaders = $oFetchResponse->GetHeaderFieldsValue();
if (0 < \strlen($sHeaders))
@ -536,6 +537,7 @@ class Message
if (0 < \strlen($sContentTypeCharset))
{
$sCharset = $sContentTypeCharset;
$sCharset = \MailSo\Base\Utils::NormalizeCharset($sCharset);
}
if (0 < \strlen($sCharset))
@ -658,6 +660,7 @@ class Message
if (0 === \strlen($sCharset) && $oBodyStructure)
{
$sCharset = $oBodyStructure->SearchCharset();
$sCharset = \MailSo\Base\Utils::NormalizeCharset($sCharset);
}
if (0 === \strlen($sCharset))
@ -680,6 +683,11 @@ class Message
if (\is_array($aTextParts) && 0 < \count($aTextParts))
{
if (0 === \strlen($sCharset))
{
$sCharset = \MailSo\Base\Enumerations\Charset::UTF_8;
}
$sHtmlParts = array();
$sPlainParts = array();
@ -693,6 +701,8 @@ class Message
{
$sTextCharset = $sCharset;
}
$sTextCharset = \MailSo\Base\Utils::NormalizeCharset($sTextCharset, true);
$sText = \MailSo\Base\Utils::DecodeEncodingValue($sText, $oPart->MailEncodingName());
$sText = \MailSo\Base\Utils::ConvertEncoding($sText, $sTextCharset, \MailSo\Base\Enumerations\Charset::UTF_8);