mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +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);
|
// && \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
|
public static function Sha1Rand(string $sAdditionalSalt = '') : string
|
||||||
{
|
{
|
||||||
return \sha1($sAdditionalSalt . \random_bytes(16));
|
return \sha1($sAdditionalSalt . \random_bytes(16));
|
||||||
|
|
|
||||||
|
|
@ -226,20 +226,14 @@ class Header
|
||||||
|
|
||||||
public function ValueWithCharsetAutoDetect() : string
|
public function ValueWithCharsetAutoDetect() : string
|
||||||
{
|
{
|
||||||
$sValue = $this->Value();
|
if (!\MailSo\Base\Utils::IsAscii($this->Value())
|
||||||
if (!\MailSo\Base\Utils::IsAscii($sValue) &&
|
&& \strlen($this->sEncodedValueForReparse)
|
||||||
\strlen($this->sEncodedValueForReparse) &&
|
&& !\MailSo\Base\Utils::IsAscii($this->sEncodedValueForReparse)
|
||||||
!\MailSo\Base\Utils::IsAscii($this->sEncodedValueForReparse))
|
&& ($mEncoding = \mb_detect_encoding($this->sEncodedValueForReparse, 'auto', true))
|
||||||
{
|
) {
|
||||||
$sValueCharset = \MailSo\Base\Utils::CharsetDetect($this->sEncodedValueForReparse);
|
$this->SetParentCharset($mEncoding);
|
||||||
if (\strlen($sValueCharset))
|
|
||||||
{
|
|
||||||
$this->SetParentCharset($sValueCharset);
|
|
||||||
$sValue = $this->Value();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return $this->Value();
|
||||||
return $sValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function IsReparsed() : bool
|
public function IsReparsed() : bool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue