第一种:(不建议使用) new String (name.getBytes("ISO-8859-1","utf-8"); 第二种:(解决post方式提交乱码) setCharacterEncoding("utf-8") 第三种:(解决get方式提交乱码) 在Tomcat配置文件server.XML中加上URIEncoding="utf-8" <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="utf-8"/>
转载于:https://www.cnblogs.com/123456lala/p/7235941.html