在本地不乱码上传到服务器就乱码了
server.xml 里的是这样
<Connector port="9021" protocol="HTTP/1.1"
connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" useBodyEncodingForURI="true"/>
JSP页面里也加了<%@ page language="java" pageEncoding="UTF-8"%>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
在本地不乱码 上传到服务器之后就乱码了到底问题在哪里勒 各位大侠怎么回事啊
http://www.honyu56.com/hongyu/freightInfoSearch2.do?method=first2&infoType=0
在这里 随便点一个市 看看咯
server.xml 里的是这样
<Connector port="9021" protocol="HTTP/1.1"
connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" useBodyEncodingForURI="true"/>
JSP页面里也加了<%@ page language="java" pageEncoding="UTF-8"%>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
在本地不乱码 上传到服务器之后就乱码了到底问题在哪里勒 各位大侠怎么回事啊
http://www.honyu56.com/hongyu/freightInfoSearch2.do?method=first2&infoType=0
在这里 随便点一个市 看看咯
String name=new String(request.getParameter("name").getBytes("iso8859_1"),"UTF-8");
没理解。。/**
* //编码
*/
public static String getBase64(String s)
{
if(s != null && !"".equals(s)){
return (new sun.misc.BASE64Encoder()).encode(s.getBytes());
}
return "";
}
post提交还可以用java.net里的一个类来过滤
具体是什么忘记了
javascript中的中文可以用全局函数encodeURI(这里为url字符串)
还可以加个过滤器过滤乱码
在server.xml中
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" />
中添加
URLEncoding="UTF-8" useBodyEncodingForURI="true"。
浏览器地址栏显示的文本编码不知道有人考虑过没,反正不全是ISO-8859-x