java接收乱码
1和2都是配置文件
1.tomcat的server.xml
添加utf-8
<Connector URLEncoding="utf-8" connectionTimeout="20000" port="8001" protocol="HTTP/1.1" redirectPort="8443"/>
2.tomcat的web.xml
<servlet>
<servlet-name>Encodeing</servlet-name>
<servlet-class>cn.hncu.com.encode.Encodeing</servlet-class>
<init-param>
<param-name>charset</param-name>
<param-value>utf-8</param-value>
</init-param>
</servlet>
3.代码实现
String 字段 = new String(乱码字段.getBytes("ISO8859-1"), "utf-8");