escaping special character in a url

You have 3 options:

escape() will not encode: @*/+ 
encodeURI() will not encode: ~!@#$&*()=:/,;?+' 
 encodeURIComponent() will not encode: ~!*()'

But in your case, if you want to pass a url into a GET parameter of other page, you should use escape or encodeURIComponent, but not encodeURI.


how to decode?

URLDecoder.decode(proxyRequestParam.replace("+", "%2B"), "UTF-8").replace("%2B", "+")

see http://stackoverflow.com/questions/2632175/java-decoding-uri-query-string


你可能感兴趣的:(escaping special character in a url)