PHP -如何转换"xea"纠正ê"的性格?(ISO-88591 -重音)


PHP - How convert chracters like "xea" to correct "ê" character? (ISO-88591 - accented)

我在text/json中有很多字符,如:

'xea = ê
'xaa = ª (I think)

如何转换到正确的字符在PHP?

你可以尝试这样做:

$text = preg_replace_callback('/''''x([0-9a-fA-F]{2})/', function ($matches) { return chr(hexdec($matches[1])); },$text);

编辑:对不起,我只是复制/粘贴了一个旧代码- e修饰符已弃用。