There are a lot of text files written on the Internet that are used to present user-defined parameters when rendering functions similar to urlencode in JS. In fact, JS itself has such parameters.
The parameter is passed in a URL-like format, so do not assign values directly.
The following is a summary of the URL encoding of variable values: encodeuricomponent (), get, and post methods can both be used to send
In Java programming scripts, there are several tips for stopping the encoding of URL strings: escape (), encodeuri (), and encodeuricomponent (). The functions of these encodings are different.
Escape () tips:
The specified string is not encoded using the ISO Latin character set. All space characters, punctuation marks, special characters, and more non-ASCII characters that are associated with each other will be converted into % XX character encodings (XX equals to the 16 encoding of the character in the character set table number ). For example, the space character is encoded as % 20.
Characters not encoded by this tip: @ */+
Encodeuri () tips:
Convert URI strings into various types of escape strings encoded in UTF-8.
Characters not encoded by this tip :! @ # $ & * () = :/;? +'
Encodeuricomponent () tips:
Convert URI strings into various types of escape strings encoded in UTF-8. Compared with encodeuri (), the trick will stop encoding more characters, such. So if the string contains several parts of the URI, do not stop encoding with that trick. Otherwise, the URL will be incorrectly rendered after the/character is encoded.
Characters not encoded by this tip :! *()'
Therefore, for Chinese strings, if you do not want to convert string encoding to various types of UTF-8 (such as the original page and the target page charset is consistent), only need to apply escape. If your page is gb2312 or more associated encoding, and the page that accepts the parameter is UTF-8 encoding, use encodeuri or encodeuricomponent.