浏览器无法正确显示unicode

时间:2014-10-13 18:54:29

标签: php html unicode utf-8

此文件已使用UTF-8:

<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 

位于顶部,但单词CAFÉ显示如下:

enter image description here

HTML是:

<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<title> form... </title>

</head>
<body>
CAFÉ
...
</body>
</html>

我该如何解决?

1 个答案:

答案 0 :(得分:4)

该文档实际上被解释为windows-1252编码。 “É”的UTF-8格式由两个字节0xC3 0x89组成。解释为windows-1252,它们表示“Ô和“‰”。

最可能的原因是服务器发送的 HTTP标头指定windows-1252作为编码(或iso-8859-1,实际上意味着相同的事情)。此信息会覆盖文档中的所有meta标记。