2013-02-08 89 views
0

如果我发送一个包含表单的UTF-8编码的HTML页面,那么浏览器没有在POST请求标题参数中指定编码是否正确?POST请求标题中缺少编码

我用当前版本的Firefox 18和Internet Explorer 9测试了它(见下文)。

根据对Why does POST not honor charset, but an AJAX request does? tomcat 6的回答,设置HTML页面编码'将设置响应编码为UTF-8并将响应标头设置为UTF-8'。

在我的测试中,响应头没有指定表单值以UTF-8编码。

这是否符合规定?

Request: POST /demo/form.html HTTP/1.1 
Accept: text/html, application/xhtml+xml, */* 
Referer: http://127.0.0.1:8080/demo/form.html 
Accept-Language: de 
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0) 
Content-Type: application/x-www-form-urlencoded 
Accept-Encoding: gzip, deflate 
Host: 127.0.0.1:8080 
Content-Length: 29 
Connection: Keep-Alive 
Cache-Control: no-cache 
+0

可能会帮助你http://stackoverflow.com/questions/2418944/how-to-force-browser-to-set-charset-in-content-type-http-header – Venu 2013-02-08 17:07:59

回答

1

中的应用/ X WWW的窗体-urlencoded媒体类型不具有字符集参数,所以浏览器行为是正确的。