A, request processing form data and distortion
1.1 data processing single form request.getParameter ( "X");
1.2 plurality of processing forms (checkbox, select) data request.getParameterValues ( "x");
Second, garbled solution:
2.1 submit data to solve the garbage
2.1.1 solve the garbage problem post submitted
request.setCharacterEncoding ( "UTF-8");
2.2 to solve the garbage problem get submitted parameters
2.2.1 to address a few parameters
String name = request.getParameter ( "name" );
= new new String name (name.getBytes ( "ISO-8859-1"), "UTF-. 8")
2.2.2 tomcat configuration settings
<Connector connectionTimeout = "20000" port = "8080" protocol = "HTTP / 1.1" redirectPort = "8443" the URIEncoding = "UTF-. 8" />
2.3 solve garbled response data
2.3.1 encoded transmission network is provided, the default is-8859-1 ISO
response.setCharacterEncoding ( "UTF-. 8");
2.3.2 settings browser encoding
the response.setContentType ( "text / HTML; charset = UTF-. 8");
2.3.3 coding process is inconsistent across different browsers
<Connector connectionTimeout = "20000" port = "8080" protocol = "HTTP / 1.1" redirectPort = "8443" URIEncoding = "utf-8" useBodyEncodingForURI = "true" />
After writing a special processing 2.3.4 distortion filter unified process the garbage problem