Escape function processing with plus signs
Chinese characters are always garbled when jqery is used for Ajax operations! The escape function must be used for encoding. encodeururicomponent and other functions are not allowed because the characters in the URL are escaped. For example, the space is encoded as the plus sign, and the plus sign is a space. We can manually encode the plus sign into % 2B, eg:
Escape (STR). Replace (// +/g, '% 2B ');
(Principles of URL escape characters
If the form action is list. JSF? Act = Go & State = 5
Then, request. getparameter can be used to obtain the values of act and state.
If your intention is the act = 'go & State = 5' string, You must escape & to get the exact act value on the server.
[Prerequisites]
For URLs submitted using the get method, the browser first parses and matches a parameter and Its Value Based on the HTTP protocol before submission. URL parameters are separated by &, which is the basis for parameter configuration in the browser. If your parameter value contains special characters such as & and URL, you will get unexpected values on the server side. Therefore, special characters of the URL must be escaped.
The encoding format is % plus the characters' ASCII code, that is, a percent sign %, followed by the corresponding characters' ASCII (hexadecimal) code value. For example, the Space Encoding value is "% 20 ".
The following table lists some special URL symbols and codes.
Hexadecimal value
1. In the + URL, the plus sign indicates space % 2B
2. the space in the space URL can be + or encoded as % 20
3./separate directories and subdirectories % 2f
4 .? Separate the actual URL and parameter % 3f
5.% specify special characters % 25
6. # indicates bookmarks % 23
7. & separator between parameters specified in URL % 26
8. = value of the specified parameter in the URL % 3d
So you should write the preceding action as list. JSF? Act = go % 26 state = 5)