How is the % hexadecimal server in the URL parsed?

Source: Internet
Author: User
About how the server parses the % hexadecimal number in the URL, I just remembered the % hexadecimal number in the url I saw. I have read some questions about how to use this encoding, this is clear .. It is said on the Internet to be compatible with certain devices that only support ASCII codes. It seems a little far-fetched. what do you think...

My question is: how does the server parse such a URL for such a hexadecimal number. How does the server determine the encoding of such a hexadecimal number?
% B7 % FE % CE % F1 % C6 % F7 % C8 % E7 .. For example, how does the server parse a string that is UTF-8 encoded or GBK or GB2321...


Reply to discussion (solution)

Urldecode
UTF-8 and GBK encoding is still different from the pattern to identify.

Can you explain the differences?

Url encoding, which is implicitly decoded by the web server
The application must explain what is passed.

This is irrelevant to the server. The encoding is interpreted by the browser and the same urlencode is processed in a unified manner. Guess, Shui WA

Grace .. It is an application problem .. But I still don't know how to determine the encoding format .. Another question is raised. for example, this encoding should be implemented in JS on the client, and the backend code should be used for parsing at the backend. This means that the encoding at both ends should be uniform, which is not hard to achieve, or that question, how can we determine the encoding?

Different browsers have different results when transmitting Chinese characters in URLs. Some are GBK, some are UTF-8, in order to prevent the inconvenience caused by the automation of the browser, the most Chinese must first urlencode processing, the receiving end to use urldecode to process.
PHP has a method for detecting character sets, but it is not very accurate and cannot be too expected.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.