js提交中文乱码的解决办法

1:前台编码 后台解码

     a:前端两次编码

         address = encodeURI(encodeURI(address));

     b:后台解码

      页面的编码 <%@ page contentType="text/html; charset=GBK"%>

       address = java.net.URLDecoder.decode(address, “GBK");

      

2:在tomcat中配置

  URIEncoding="utf-8"               
                redirectPort="8443" />
    

               connectionTimeout="20000"
               redirectPort="8443" useBodyEncodingForURI="true"/>

 

你可能感兴趣的:(java,基础)