【java 中解决中文乱码问题的方法】

1. 重新定义。 String str = "冲虫虫" ; str = new String(u.getBytes("iso-8859-1"),"utf-8");

  2. 使用过滤器解决。

  3. 修改Tomcat配置server.xml,

  <Connector port="80" protocol="HTTP/1.1"               connectionTimeout="20000"                redirectPort="8443"  />改为:

  <Connector port="80" protocol="HTTP/1.1"                connectionTimeout="20000"  URIEconding="UTF-8"            redirectPort="8443"  />

posted @ 2013-07-27 14:41  豆豆逗逗  阅读(123)  评论(0编辑  收藏  举报