URL decode problem Solutions _php tips

Source: Internet
Author: User
Tags reserved rfc url decode
The Urllib Library of Python and the encodeuricomponent of JS are not replaced. The space encode is also replaced by '%20 '. Python provides urllib.quote_plus, urlib.unquote_plus to handle the space-> Plus, which seems reasonable.

Checked the RFC 3986: There is a paragraph below

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

The plus "+", Dollar "$", and comma "," characters have been added to those in the "reserved" set, since they are As reserved within the query component.
Indicates that the plus sign is already a reserved word for the URL and does not need to be escaped.

Then there is the escape of the plus sign in the HTML4 document:

application/x-www-form-urlencoded
Forms submitted with the content type must be encoded as follows:
Control names and values are escaped. Space characters are replaced by ' + ', and then reserved characters ...
The declaration will only be escaped when the Content-type is application/x-www-form-urlencoded.

and flipped down the PHP document and found a

Rawurlencode ()-Url-encode according to RFC 3986


That is, PHP and the Rawurlencode and Rawurldecode to achieve the standard ....

Can not reverse, after all, most people should be used UrlEncode. PHP is a pain in the egg ah ....

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.