开发者

validator.w3.org reports a markup error - detected character encoding "utf-8"

开发者 https://www.devze.com 2023-03-12 04:02 出处:网络
validator.w3.org reports for www.besaltnlight.ca: Character Encoding Override in effect! The detected character encoding \"utf-8\" has been suppressed and \"iso-8859-1\" used instead.

validator.w3.org reports for www.besaltnlight.ca:

Character Encoding Override in effect! The detected character encoding "utf-8" has been suppressed and "iso-8859-1" used instead.

The php code outputs iso-8859-1 and php sets that as the default characterse开发者_如何学JAVAt.

What is causing this problem? Am I using the wrong doctype?

Oh, and would any of this cause quirks mode in IE?

Thanks for your help.

Gerry


The document is encoded in UTF-8. It has a byte order mark, smart quotes, and an ellipsis, all properly encoded in UTF-8. It begins with two byte order marks, which is invalid. You must remove one, and the validator also says that the presence of a BOM in a UTF-8 document may be confusing, so you may remove them both.

Since you’re outputting UTF-8, you must change the HTTP header to:

Content-type: text/html; charset=utf-8

Since you are missing that header, you force the browser to guess. Additionally, the meta tag must be changed to

<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

for the same reason.


Your output starts with a Unicode byte order mark, encoded in UTF-8.

This is likely the first some bytes of your PHP file, or any PHP file included by your main file. Your editor may not even show them. Interpreted as ISO-8859-1 the start of the output looks like <!DOCTYPE html, which are even two byte order marks, one after each other.

As said by jleedev, either make sure your files are really encoded in Latin-1, or declare the encoding as UTF-8.

0

精彩评论

暂无评论...
验证码 换一张
取 消