By default, Tomcat's default encoding for requests is iso-8859-1, so that the characters we submit are considered iso-8859-1 encoded, so garbled when they are received in the program. Call Request.setcharacterencoding ("GBK") in the filter, then the Chinese characters on the post will be considered GBK encoded, and TOMCAT5 's code for GET requests does not recognize the encoding according to the filter settings, The default is still iso-8859-1, so even if your page is encoded using the default encoding, and then decoded using iso-8859-1, the results are incorrect.
Workaround:
Add two settings to <connector in Conf/server.xml in Tomcat
Usebodyencodingforuri= "true"//set post and get using the same encoding
uriencoding= "UTF-8"//URI using UTF-8 encoding processing
You can use string to provide the encoding conversion test, the requested parameter value:
name = new String (name.getbytes ("iso8859-1"), "UTF-8"). Trim ();
System.out.println ("Name:" + name)
How to solve the garbled problem of Tomcat deployment GET request in Linux