Go to: http://jc-dreaming.iteye.com/blog/1702407
This paper discusses how to encode and decode the passing parameters with JS
1: The correspondence between encoding and decoding method
Escape-----------------------------------------------------unescape
encodeURI-------------------------------------------------decodeURI
encodeURIComponent-----------------------------------encodeURIComponent
2: Decoding and Encoding method usage
such as Var value1=escape (' 1² '); var getvalue1=unescape (value1); encodeURI, Decodeuri,encodeuricomponent, encodeuricomponent usage and escape,unescape usage are all the same.
3: Differences and linkages between three coding methods
Encoding method: encodeURI, encodeuricomponent are used UTF-8 to encode the parameters, and escape is not.
Characters that will not be encoded: encodeURI: ":", "/", ";" and "?" characters are encoded.
Usage occasions: Escape does not encode URLs, if you want to encode URLs, you should use encodeURI or encodeURIComponent, the corresponding decoding method is also the case.
Recommended method Order: encodeURIComponent--encodeuri--escape.
Note: With encodeURIComponent, encodeURI in the foreground encoded string, can be directly in the background with Java decoding way Urldecoder.decode (Val, "UTF-8"); The reason is that the two methods themselves are encoded as UTF-8. It is convenient to use.
JS escape, encodeURI, encodeuricomponent encoding and decoding [turn]