0

I have a test.html file on server. The file itself is saved with UTF-8 encoding.

But I explicitly specified <meta charset="ISO-8859-1"> in the file content.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="5">
<meta charset="ISO-8859-1">
</head>

<body>
<h1>My Website 报喜不能不</h1>
<p>Some text...</p>
</body>

</html>

Since the page contains some Chinese characters, I am expecting some client-side displaying error. But no errors. And in Firefox page info, it says the page encoding is UTF-8. Seems the <meta charset="ISO-8859-1"> is not effective.

Why?

smwikipedia
  • 61,609
  • 92
  • 309
  • 482
  • Have a look at the second answer (with 186 votes) here: http://stackoverflow.com/questions/4696499/meta-charset-utf-8-vs-meta-http-equiv-content-type, may be helpful – modal_dialog Nov 24 '15 at 06:18
  • ..also, just wondering: since UTF-8 is the default and preferred for HTML5, any reason not to use it? It will support those characters and more. http://stackoverflow.com/questions/7048745/what-is-the-difference-between-utf-8-and-iso-8859-1 – modal_dialog Nov 24 '15 at 06:28
  • Just doing some experiment here... – smwikipedia Nov 24 '15 at 06:56

0 Answers0