求URI 中文乱码解决方案

求URI 中文乱码解决方案

楼主是说的URL传递中文时的乱码吗?

一般遇到的乱码问题可以通过下面的方式来解决:
[quote]
1.确定JSP页面头部是否有:
[code="java"]<%@ page contentType="text/html; charset=GBK" %>[/code]

2.用这个转码:
String param= new String(request.getParameter("param").getBytes("ISO-8859-1"), "GBK");

3.添加filter字符过滤器

4.如果是通过"a.jsp?param=中文"传递参数,则需要:
a.在传参数之前先把参数进行转码:java.net.URLEncoder.encode(param);
取值时用java.net.URLDncoder.decode(param);再转回中文

b.在你的Tomcat目录-->conf目录-->server.xml里找出这段:
port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" URIEncoding="gb2312"
/>
[/quote]

Ps:引用部分由Google而来

很多人问过的问题,看一下这个
[quote][url]http://www.iteye.com/problems/181[/url][/quote]

web.xml 里加上

encodingFilter

org.springframework.web.filter.CharacterEncodingFilter


encoding
UTF-8

看看这篇文章:
http://wxy32.iteye.com/admin/blogs/210703