mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 19:49:20 +03:00
Resolve #555
This commit is contained in:
parent
b011d1fa0e
commit
aa01343df8
2 changed files with 7 additions and 24 deletions
|
|
@ -1008,17 +1008,6 @@ abstract class Utils
|
|||
// && \is_callable($mFunctionNameOrNames);
|
||||
}
|
||||
|
||||
public static function CharsetDetect(string $sStr) : string
|
||||
{
|
||||
$mResult = '';
|
||||
if (!static::IsAscii($sStr))
|
||||
{
|
||||
$mResult = \mb_detect_encoding($sStr, 'auto', true);
|
||||
}
|
||||
|
||||
return \is_string($mResult) && \strlen($mResult) ? $mResult : '';
|
||||
}
|
||||
|
||||
public static function Sha1Rand(string $sAdditionalSalt = '') : string
|
||||
{
|
||||
return \sha1($sAdditionalSalt . \random_bytes(16));
|
||||
|
|
|
|||
|
|
@ -226,20 +226,14 @@ class Header
|
|||
|
||||
public function ValueWithCharsetAutoDetect() : string
|
||||
{
|
||||
$sValue = $this->Value();
|
||||
if (!\MailSo\Base\Utils::IsAscii($sValue) &&
|
||||
\strlen($this->sEncodedValueForReparse) &&
|
||||
!\MailSo\Base\Utils::IsAscii($this->sEncodedValueForReparse))
|
||||
{
|
||||
$sValueCharset = \MailSo\Base\Utils::CharsetDetect($this->sEncodedValueForReparse);
|
||||
if (\strlen($sValueCharset))
|
||||
{
|
||||
$this->SetParentCharset($sValueCharset);
|
||||
$sValue = $this->Value();
|
||||
}
|
||||
if (!\MailSo\Base\Utils::IsAscii($this->Value())
|
||||
&& \strlen($this->sEncodedValueForReparse)
|
||||
&& !\MailSo\Base\Utils::IsAscii($this->sEncodedValueForReparse)
|
||||
&& ($mEncoding = \mb_detect_encoding($this->sEncodedValueForReparse, 'auto', true))
|
||||
) {
|
||||
$this->SetParentCharset($mEncoding);
|
||||
}
|
||||
|
||||
return $sValue;
|
||||
return $this->Value();
|
||||
}
|
||||
|
||||
public function IsReparsed() : bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue