-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
first off, utf8_decode() is deprecated as of PHP8.2, and you should use
mb_convert_encoding($str, 'utf-8', 'ISO-8859-1')
instead,
second, utf8_decode converts data from ISO-8859-1 to UTF-8,
which means that if your XML document is not encoded with ISO-8859-1, the function
/**
* Replaces all html entities into its original symbols.
*
* @param string $content
* @return string
*/
public function convertEntities($content)
{
$table = array_map('utf8_encode', array_flip(
array_diff(
get_html_translation_table(HTML_ENTITIES),
get_html_translation_table(HTML_SPECIALCHARS)
)
));
return preg_replace('/&#[\d\w]+;/', '', strtr($content, $table));
}
doesn't even make sense, and is likely to corrupt UTF-8 XMLs..
Metadata
Metadata
Assignees
Labels
No labels