I'm doing a test, how the Firefox encoding character.
But the fact confused me.
HTML code:
<html lang="zh_CN">
<head>
<title>some Chinese character</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<img src="http://localhost/xxx" />
</body>
The xxx is some Chinese characters. These character must be encode into format like %xx to transport by HTTP.
First, I encoding the source file in UTF-8. use firefox to open the html file. The img label will send a request, "xxx" character were encoded by UTF8.
- (encode HTML source file by UTF8, charset=utf8, the browser encode URL by UTF)
I changed the meta into
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
but nothing changed.
- (encode HTML source file by UTF8, charset=gbk, the browser encode URL by UTF)
Second, I save the source file in ANSI, maybe GBK or GB2312.
when the charset=gbk, still encoding the character by UTF8.
- (encode HTML source file by GBK, charset=gbk, the browser encode URL by UTF)
BUT, when the charset=utf8, the characters were encoding by GBK. By the way, other Chinese character can't display in right way, e.g. the String in title.
- (encode HTML source file by GBK, charset=utf8, the browser encode URL by GBK)
How to control the browser's encoding behavior?