json中文乱码问题

首先在 tomcat的 D:\apache-tomcat-7.0.57\conf\server.xml里添加中文编码

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

 

前台处理

element.value=encodeURI(value,"utf-8");

 

后台处理

try {
	URLDecoder.decode(value,"utf-8");
} catch (Exception e) {
	e.printStackTrace();
}
		

 

posted @ 2016-08-19 11:20  wujixing909  阅读(307)  评论(0编辑  收藏  举报