Why is the URL not sent directly but encoded before being sent?

Source: Internet
Author: User
Tags control characters

First, the protocol specification, RFC 1738, defines that the URL address cannot contain characters other than: 0-9, A-Za-Z,-, that is, the URL contains special characters, for example, $ -_. +! * '(), All must be encoded.
There are several reasons for such definition:
1. Many special characters in HTML code, such as '#', are used to locate HTML (Anchor). Therefore, such characters have special meanings, it cannot be directly used for sending and must be encoded.
2. if it contains some non-printable control characters, it cannot be printed and displayed normally. Therefore, it must be encoded before transmission. Functions/control characters in the ASCII character set.
3. Some Reserved characters (&, =,:) and unsafe characters (<, >,#) are also required. Therefore, the URL address must be encoded.
4. There are also some easy-to-think characters, such as spaces. If they appear in the URL address, it is difficult to determine whether the content before and after the space belongs to the URL. Therefore, for special characters such as spaces, it must be encoded.

Why is the URL not sent directly but encoded before being sent?

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.