PHP's Rawurlencode and UrlEncode functions
Problem: 2 functions are for string escaping so that they are suitable for file names. Which one should I use? Which is more standard?
Conclusion:
Rawurlencode Compliance is the 94 international standard memo RFC 1738,
UrlEncode is the traditional approach, and the main difference is that the escape from the space is ' + ' instead of '%20 '
JavaScript's encodeURI is also the 94 standard,
The escape of JavaScript is another way to mark Unicode encoding with "%xxx".
Recommended for use with Rawurlencode in PHP. Discard UrlEncode
Note: PHP rawurlencode! = JS encodeURI
?
Sample Example
Source
Super Invincible person Sadha SAJDH Data sample Sdls Fhejrthcxzb.file.jpeg
PHP UrlEncode:
%e8%b6%85%e7%ba%a7%e6%97%a0%e6%95%8c%e7%9a%84%e4%ba%basadha+sajdh%e6%95%b0%e6%8d%ae%e6%a0%b7%e6%9c%acsdls+ Fhejrthcxzb.file.jpeg
PHP Rawurlencode:
"%b3%ac%bc%b6%ce%de%b5%d0%b5%c4%c8%cbsadha%20sajdh%ca%fd%be%dd%d1%f9%b1%besdls%20fhejrthcxzb.file.jpeg
Javascript encodeURI:
%e8%b6%85%e7%ba%a7%e6%97%a0%e6%95%8c%e7%9a%84%e4%ba%basadha%20sajdh%e6%95%b0%e6%8d%ae%e6%a0%b7%e6%9c%acsdls% 20fhejrthcxzb.file.jpeg
Javascript Escape:
%u8d85%u7ea7%u65e0%u654c%u7684%u4ebasadha%20sajdh%u6570%u636e%u6837%u672csdls%20fhejrthcxzb.file.jpeg
?