开发者

What charset encoding is used for HTTP GET requests URL? [duplicate]

开发者 https://www.devze.com 2023-04-12 00:55 出处:网络
This question already has answers here:开发者_运维知识库 Closed 11 years ago. Possible Duplicate:
This question already has answers here: 开发者_运维知识库 Closed 11 years ago.

Possible Duplicate:

What's the correct encoding of HTTP get request strings?

One of my clients sent me they require HTTP requests to be encoded in ISO-8859-2,

so I wonder about what charset is used for HTTP communication, and if this request is somehow technicaly right.


It depends. A "smart" server will always use percent-escaped UTF-8, but you can't rely on that.


Pure ASCII is all that's allowed in HTTP headers. But, as far as HTTP is concerned, anything goes in the request body of a POST. The headers and body are always separated by a blank line. A set of headers will normally identify the format of the content/body. Responses work the same way. However, HTML has some additional rules regarding what normally goes in a POST.

EDIT: Sorry, I missed the word 'GET' in your title. Might be nice to duplicate that in the body of your question.

At any rate, I believe I am correct in saying ONLY ASCII (ANSI X3.4-1986) is allowed in the headers of any HTTP request, GET or POST. So no, ISO-8859-2 requests are not strictly valid HTTP. That said, there's probably a way to escape the desired special characters in the query string if that's what you're really asking for here.

SOURCE: https://www.rfc-editor.org/rfc/rfc2616

0

精彩评论

暂无评论...
验证码 换一张
取 消