Validation error: Byte-Order Mark found in UTF-8 File

和自甴很熟 提交于 2019-12-18 04:12:59

问题


I'm working on a website and while displaying it on Firefox is fine, on IE I've got a lot of problems. I used the w3c validator and I got a lot of strange errors.

Here's the link to the website: http://misenplacecatering.it/

The first validation error, I think the most relevant, is this:

Byte-Order Mark found in UTF-8 File. The Unicode Byte-Order Mark (BOM) in UTF-8 encoded files is known to cause problems for some text editors and older browsers. You may want to consider avoiding its use until it is better supported. 

and

Line 1, Column 1: Non-space characters found without seeing a doctype first. Expected <!DOCTYPE html>.

I've read other threads about this issue so I tried to open the file with different editors (I always use Vim, anyway), but I don't see any space or anything else before the doctype definition. I even used notepad++ and used an option to remove bom, but nothing.

Any suggestions?

Anyway,


回答1:


if using notepad++, use Convert to UTF-8 without BOM.

if you are using php, make sure that any included/required file is in either in ascii or UTF without BOM, as php doesn't handle non-ascii file very good (this one gave me a headache once)

you could try converting your files to ascii, if you don't need utf characters

on your <meta charset > try writing the value within quotes




回答2:


The free text editor PSPad has a hex editing mode which is very handy for seeing exactly what you really have in your text files.



来源:https://stackoverflow.com/questions/6986804/validation-error-byte-order-mark-found-in-utf-8-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!