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

Carlo picture Carlo · Aug 8, 2011 · Viewed 9.6k times · Source

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,

Answer

Einacio picture Einacio · Aug 8, 2011

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