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 RFC1738, a 94-year international standard memorandum. urlencode implements the traditional practice. The main difference between rawurlencode and urlencode of PHP is that
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