Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm working on a website and, while displaying it on Firefox is fine, on Internet Explorer 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, which I think is 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 questions 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 the BOM, but nothing.

How can I fix it?

like image 408
Carlo Avatar asked Aug 08 '11 18:08

Carlo


1 Answers

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 a BOM, as PHP doesn't handle non-ASCII file very well (this one gave me a headache once)

You could try converting your files to ASCII, if you don't need UTF characters.

In your <meta charset> attribute, try writing the value within quotes.

like image 192
Einacio Avatar answered Nov 05 '22 09:11

Einacio