简体   繁体   中英

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?

You can use META. Like this:

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

"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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM