mirror of
https://github.com/e107inc/e107.git
synced 2025-08-19 04:41:53 +02:00
Related to Issue #3741 - Incorrect encoding of a plugin language file could cause json encoding to fail.
This commit is contained in:
@@ -2120,7 +2120,36 @@ class e_parse extends e_parser
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $mixed
|
||||
* @return array|false|string
|
||||
*/
|
||||
public function toUTF8($mixed)
|
||||
{
|
||||
|
||||
if(is_array($mixed))
|
||||
{
|
||||
foreach($mixed as $k => $v)
|
||||
{
|
||||
unset($mixed[$k]);
|
||||
$mixed[$this->toUTF8($k)] = $this->toUTF8($v);
|
||||
}
|
||||
}
|
||||
elseif(is_object($mixed))
|
||||
{
|
||||
$objVars = get_object_vars($mixed);
|
||||
foreach($objVars as $key => $value)
|
||||
{
|
||||
$mixed->$key = $this->toUTF8($value);
|
||||
}
|
||||
}
|
||||
elseif(is_string($mixed))
|
||||
{
|
||||
return iconv('UTF-8', 'UTF-8//IGNORE', utf8_encode($mixed));
|
||||
}
|
||||
|
||||
return $mixed;
|
||||
}
|
||||
|
||||
|
||||
function toASCII($text)
|
||||
|
Reference in New Issue
Block a user