request Chinese garbled solution

POST request

request.setCharacterEncoding("UTF-8");

 

GET and POST requests

Page:. 8 UTF- 
the Tomcat: ISO8859 -1 

Solutions: 
page (UTF -8 coding) - the Tomcat (iso8859- . 1 decoding) 
first ISO8859 -1 encoding, then UTF- . 8 decoder 
String STR = request.getParameter ( "" ) ;
 new new String (str.getBytes ( "ISO8859-1"), "UTF-. 8")

 

Guess you like

Origin www.cnblogs.com/archer-wen/p/11294254.html