I had a web page template that was basically just:
<html>
<body>...</body>
</html>
But text in the body was (incorrectly) being interpreted as latin1 by my browser. So I changed it to:
<?xml encoding="utf-8"?>
<html>
<body>...</body>
</html>
This fixed the problem and the text was interpreted correctly as UTF-8 in my paticular browser (Chrome 17.x on Linux 3.x), however...
What is the best way (most current browser-compatible and forward-compatible) to specify that the text in a html page is encoded in UTF-8?
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
...
</head>
I would think, this HTML4 way:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
... etc
Cut and pasted from a web page of mine.
Don't put an <?xml?>
on non-xml. Use a meta
tag to specify the http content type charset.
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.