我用的tomcat5.5,在server.xml中配置了URIEncoding="utf-8"属性,URL参数是“苏网维02-网管机房值班日志(班).xls”。
我是在jsp中接受这个参数的,但是冲request中取出的时候,参数却是“苏网�?2-网管机房值班日志(�?.xls”。
请高手解决。
我用的tomcat5.5,在server.xml中配置了URIEncoding="utf-8"属性,URL参数是“苏网维02-网管机房值班日志(班).xls”。
我是在jsp中接受这个参数的,但是冲request中取出的时候,参数却是“苏网�?2-网管机房值班日志(�?.xls”。
请高手解决。
javascript url 编码(UTF-8) jsp 解码
1. encode.html
2.
decode.jsp
/*
* <script language="JavaScript">
* document.write(encodeURI('http://www.blogjava.net/chenlb/abc 中文'));
* </script>
*/
String url = "http://www.blogjava.net/chenlb/abc%20%E4%B8%AD%E6%96%87";
try {
System.out.println(URLDecoder.decode(url, "UTF-8"));
System.out.println(URLDecoder.decode(url, "GBK"));//乱码
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}