Rawurlencode and urlencode of PHP

Source: Internet
Author: User
PHP rawurlencode and urlencode problems: both functions are for string escaping so that they are suitable for file names. Which one should I use? Which is more standard? Conclusion: rawurlencode complies with the international standard memorandum RFC1738, the main difference with the above is that the escape of space is + rather than % 20javascript's encodeURL is also the 94-year standard PHP rawurlencode and urlencode

Problem: both functions are for string escaping so that they can be used as file names. Which one should I use? Which is more standard?

Conclusion:
Rawurlencode complies with RFC 1738,
Urlencode implements the traditional method. The main difference between urlencode and the above method is that the escape of spaces is '+' rather than '% 20'
The encodeURL of javascript is also a 94-year standard,

Javascript escape is another way to mark unicode encoding with "% xxx.

Rawurlencode is recommended in PHP. Discard urlencode

?

Example
Source:

Super invincible sadha sajdh data sample sdls fhejrthcxzb.file.jpeg

PHP urlencode:

Bytes

PHP rawurlencode:

Bytes

Javascript encodeURI:

Bytes

Javascript escape:

Bytes

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.