Url decode problem Solution

Source: Internet
Author: User

After testing, the python urllib library and js encodeURIComponent will not be replaced. The space encode is also replaced with '% 20 '. Python provides urllib. quote_plus and urlib. unquote_plus to handle Space-> plus signs, which looks reasonable.

Check RFC 3986.

Scheme names consist of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus ("+"), period (". "), or hyphen ("-").
RFC 2396 has the following section

The plus "+", dollar "$", and comma "," characters have been added to those in the "reserved" set, since they are treated as reserved within the query component.
It indicates that the plus sign is a reserved word of the url and does not need to be escaped.

Then there is an escape for the plus sign in the html4 document:

Application/x-www-form-urlencoded
Forms submitted with this content type must be encoded as follows:
Control names and values are escaped. Space characters are replaced by '+', and then reserved characters .....
It is declared that only content-type is application/x-www-form-urlencoded will escape +.

I flipped through the php document and found

Rawurlencode ()-URL-encode according to RFC 3986.


That is, php implements rawurlencode and rawurldecode to implement the standard ....

Can't it be reversed? After all, most people should use urlencode. Php really hurts ....

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.