日期:2014-05-16  浏览次数:20370 次

js处理乱码

JS传参之中文乱码解决方案:
传参:用encodeURI("url参数")将url编码
收参:用decodeURI("接收到的值")解码



var distName = encodeURI(document.getElementById("distName").value);


String distName = request.getParameter("distName");
java.net.URLDecoder.decode(distName, "UTF-8")


distName = java.net.URLDecoder.decode(distName, "UTF-8");
jsp页面URLEncoder.encode(request.getParameter("deptName"),"utf-8");