POST请求标头中缺少编码

时间:2013-02-08 16:49:11

标签: html forms http encoding

如果我发送包含表格的UTF-8编码的HTML页面,浏览器是否在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

1 个答案:

答案 0 :(得分:1)

application / x-www-form-urlencoded媒体类型没有charset参数,因此浏览器行为正确。

相关问题