fix/catch PHP 8.0 ValueError: mb_convert_encoding(): Argument #3 ($from_encoding) contains invalid encoding "cp1250"

This commit is contained in:
Ralf Becker 2021-11-10 12:43:03 +01:00
parent 365982025a
commit 8d25c83380

View File

@ -947,9 +947,14 @@ class Translation
{
return utf8_decode($data);
}
if (self::$mbstring && !$prefer_iconv && ($data = @mb_convert_encoding($data,$to,$from)) != '')
{
return $data;
try {
if (self::$mbstring && !$prefer_iconv && ($data = @mb_convert_encoding($data, $to, $from)) != '')
{
return $data;
}
}
catch (\ValueError $e) {
// ignore encodings unknown to mb_convert_encoding
}
if (function_exists('iconv'))
{