In the use of Jqery do Ajax when the Chinese is always garbled! Must use the Escape function encoding is normal, encodeuricomponent and other functions can not, this is because the characters in the URL is escaped, such as the space is encoded as a plus, so the plus sign is a space. We can manually encode the plus sign into%2b,eg:
Escape (str). replace (//+/g, '%2b '); that's it.
(URL escape Character principle
If the action of the form is list.jsf?act=go&state=5
The value of Act and state can be obtained separately by Request.getparameter when committing.
If your intention is to act= ' go&state=5 ' This string, then to get the exact value of the act on the server, you must escape &
[Preliminary knowledge]
For URLs that are submitted with a Get method, the browser first parses one by one parameters and their values into pairs based on the HTTP protocol before committing. And the URL of the parameters are divided by &, this is the browser for parameter configuration of the segmentation basis. If your parameter value contains a URL special character such as &, you will get an unexpected value on the server side. Therefore, the special characters of the URL must be escaped.
The encoded format is: The ASCII code of the% plus character, which is a percent percent, followed by the ASCII (16-binary) code value of the corresponding character. For example, the encoded value of a space is "%20".
Some URL special symbols and codes are listed in the following table.
Hexadecimal value
1. + URL + sign for space%2b
2. Spaces in the space URL can be used with the + number or code%20
3./separate directories and subdirectories%2f
4.? Separating the actual URLs and parameters%3f
5.% Specify special characters%25
6. # means bookmark%23
7. The delimiter between the parameters specified in the & URL%26
8. = value of the specified parameter in the URL%3d
So the above action you should write list.jsf?act=go%26state=5)
The escape function handles the problem with the plus string