gpt4 book ai didi

forms - 应用程序/x-www-form-urlencoded 和字符集 ="utf-8"?

转载 作者:可可西里 更新时间:2023-11-01 15:05:00 25 4
gpt4 key购买 nike

当 Content-type 为 application/x-www-form-urlencoded 时,是否习惯省略 ;charset="utf-8"

特别是,当在表单标签中使用 accept-charset="utf-8" 时,我希望有一些迹象表明标题中使用了 utf-8,但我没有看到任何。

这是我在 Chrome 中的简单测试。表单页面为:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
</head>
<body>
<form method="POST" action="printenv.cgi" accept-charset="utf-8">
Your name:
<input name="name" type="text" size="30">
</form>
</body>
</html>

生成的请求的 header 是:

POST /printenv.cgi HTTP/1.1
Host: ...:8000
Connection: keep-alive
Content-Length: 19
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Origin: http://...:8000
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://...:8000/utf8-test.html
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

指定表单参数值编码方式的约定是什么?

最佳答案

  1. 没有为此媒体类型定义的字符集参数。

  2. 有关编码指南,请参阅 https://url.spec.whatwg.org/#application/x-www-form-urlencoded .

application/x-www-form-urlencoded 标准暗示了 UTF-8 和百分比编码。

虽然:

A legacy server-oriented implementation might have to supportencodings other than UTF-8 as well as have special logic for tuples ofwhich the name is _charset. Such logic is not described here as onlyUTF-8 is conforming.

关于forms - 应用程序/x-www-form-urlencoded 和字符集 ="utf-8"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16819502/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com