Mulligan
Mulligan

Reputation: 210

HTML UTF-8 encoding

When I save in an editor (Notepad++) an HTML file as "utf-8" encoded the meta tag charset (=ISO-8859-2) seems to be ignored by browser (charset is always set to "utf-8", not matter which encoding i have set in meta tag)

What's more interesting when i save this doc as "ANSI" encoded file changing tag charset works...

Can You please explain me such a behaviour?

Upvotes: 0

Views: 1103

Answers (2)

deceze
deceze

Reputation: 522606

"UTF-8" in Notepad++ really means "UTF-8 with BOM". The leading BOM very likely triggers UTF-8, regardless of what anything else is saying, since no other document should start with that particular byte sequence. Try saving as "UTF-8 without BOM" to see the difference.

Upvotes: 1

Fredy
Fredy

Reputation: 2910

You can use META. Like this:

<head>
<meta charset="utf-8">
</head>

Upvotes: 1

Related Questions