Does somebody know what charset the HTTP Headers used to encode?

做~自己de王妃 提交于 2019-12-11 23:31:23

问题


Like the problem described by title, my problem is when I read the Http header that returned from the server in the android programs , it appears Disorderly code of strings, so, what I don't know is, what kind of charset the server used to encoding the http response Headers ?and what charset the andorid used to decode the http response headers? How do I escape or deal the Garbled?


回答1:


Since HTTP Headers are MIME, see RFC 822 where it is defined as ASCII.

3.1.2. STRUCTURE OF HEADER FIELDS

Once a field has been unfolded, it may be viewed as being composed of a field-name followed by a colon (":"), followed by a field-body, and terminated by a carriage-return/line-feed. The field-name must be composed of printable ASCII characters (i.e., characters that have values between 33. and 126., decimal, except colon). The field-body may be composed of any ASCII characters, except CR or LF. (While CR and/or LF may be present in the actual text, they are removed by the action of unfolding the field.)

Then RFC 2047

describes extensions to RFC 822 to allow non-US-ASCII text data in Internet mail header fields



来源:https://stackoverflow.com/questions/9416470/does-somebody-know-what-charset-the-http-headers-used-to-encode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!