1. The client uses the encodeuri or encodeuricompent parameter for UTF-8 encoding when submitting the request, and then sends it to the server. If the POST method is used, request. setcharacterencoding can be used to set the encoding used to interpret the parameter. If you use the get method, use the new string (Arg. getbytes ("iso-8859-1"), "UTF-8") method for transcoding.
2. when sending an Ajax request, use the POST method. Because Ajax uses UTF-8 encoding by default to submit parameters, if the file is not uploaded, set "application/X-WWW-form-urlencoded; charset =" UTF-8 "for the Content-Type request header of Ajax to notify the server that the client uses encoding to send parameters. In this way, the server can directly obtain the transcoded parameter value through string word = request. getparameter ("word");, saving request. setcharacterencoding.
.
On your page, you need to specify the page encoding, such as <meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8 "/> 2. specify the output encoding on your server, such as response. charset = "UTF-8"; 3. the character encoding of front-end pages and backend pages must be UTF-8. In this way, the request will not be garbled. If the request is still garbled, you will use escape () to encode the request and then send it again, and then use Unescape () decode the request and then process it.