Miguel Moura
Miguel Moura

Reputation: 39384

Fix Enconding with BOM in file ... Working on MVC project

I am working on an MVC site with Visual Studio 2012.

When I validate the site in W3C I get a Warning:

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. 

I used Notepad ++ to change the enconding from UTF-8 to UTF-8 without BOM.

In this case some characters (á, ç, à, ...) in the webpage are displayed in a strange way ...

How can I fix this?

Thank You, Miguel

Upvotes: 1

Views: 772

Answers (1)

Yishai Galatzer
Yishai Galatzer

Reputation: 8862

I'd typically not worry too much about this warning.

But if you care you can add a meta tag to your files and also do the conversion in visual studio itself.

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

Here is an so thread on how to save without BOM in visual studio: UTF-8 without BOM

Upvotes: 1

Related Questions