问题描述
如果没有给出字符集,应该使用什么来解码multipart / form-data的默认编码? RFC2388声明:
what is the default encoding one should use to decode multipart/form-data if no charset is given? RFC2388 states:
每个部分multipart / form-data应该有一个content-
类型。在field元素为text的情况下,文本的charset
参数表示使用的字符编码。
Each part of a multipart/form-data is supposed to have a content- type. In the case where a field element is text, the charset parameter for the text indicates the character encoding used.
例如,带有文本字段的表单其中用户键入'Joe欠
< eu> 100',其中< eu>是欧元符号可能有表格数据返回
as:
For example, a form with a text field in which a user typed 'Joe owes <eu>100' where <eu> is the Euro symbol might have form data returned as:
--AaB03x
content-disposition: form-data; name="field1"
content-type: text/plain;charset=windows-1250
content-transfer-encoding: quoted-printable>>
Joe owes =80100.
--AaB03x
在我的情况下,charset未设置,我不知道如何解码该text / plain部分中的数据。因为我不想强制执行不是标准行为的事情,所以我在问这个案例中的预期行为是什么。 RFC似乎没有解释这一点,所以我有点迷失。
In my case, the charset isn't set and I don't know how to decode the data within that text/plain section. As I do not want to enforce something that isn't standard behavior I'm asking what the expected behavior in this case is. The RFC does not seem to explain this so I'm kinda lost.
谢谢!
推荐答案
的默认字符集是ISO-8859- 1(Latin1),我猜这也适用于此。
The default charset for HTTP 1.1 is ISO-8859-1 (Latin1), I would guess that this also applies here.
- snip -
--snip--
这篇关于multipart / form-data,字段的默认字符集是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!