When using JS to pass parameters between each HTML page, some special words nginx in the past to receive the problem, the best way is to pass the parameters before encoding, received and then decoded. Collected a few of the commonly used functions
1.escape
Http://www.w3school.com.cn/jsref/jsref_escape.asp
2.encodeURI
Http://www.w3school.com.cn/jsref/jsref_encodeuri.asp
3.encodeURIComponent
Http://www.w3school.com.cn/jsref/jsref_encodeURIComponent.asp
Got a little information about their differences.
Escape () cannot be used directly for URL encoding, and its true function is to return a Unicode encoded value of a character. For example, "Spring Festival" return result is%u6625%u8282,,escape () not "+" coding is mainly used for Chinese character coding, now is not advocated for use.
encodeURI () is a function in JavaScript that is really used to encode URLs. Encode the entire URL address, but to the special meaning of the symbol "; / ? : @ & = + $, # ", also not encoded. The corresponding decoding function is: decodeURI ().
encodeURIComponent () can encode "; / ? : @ & = + $, # "these special characters. The corresponding decoding function is decodeURIComponent (). If you want to pass the URL with the & symbol, use encodeURIComponent ()
URL encoding and decoding