为什么html_entity_decode()
将"ó"解码为未知字符?
echo "ó -> ".html_entity_decode('ó');
给出以下结果:
ó -> �
原始格式(不由浏览器解释):
ó -> �
字符集是 UTF8。
这是因为默认编码是ISO-8859-1
的(对于5.4之前的PHP)。将其设置为 UTF-8
在 html_entity_decode
的第三个参数中。
为什么html_entity_decode()
将"ó"解码为未知字符?
echo "ó -> ".html_entity_decode('ó');
给出以下结果:
ó -> �
原始格式(不由浏览器解释):
ó -> �
字符集是 UTF8。
这是因为默认编码是ISO-8859-1
的(对于5.4之前的PHP)。将其设置为 UTF-8
在 html_entity_decode
的第三个参数中。