javascript url 传递参数中文乱码问题解决方案
html页面:
function testOne() {
var url = "testTwo.action?expr="+你好;
window.location.href = encodeURI(url);
}
后台java代码:
String expr = new String(request.getParameter("expr").getBytes("ISO-8859-1"),"UTF-8");
方案二
html页面:
function testTwo() {
var url = "testTwo.action?expr="+你好;
window.location.href= encodeURI(encodeURI(url));
}
后台java代码:
String expr = java.net.URLDecoder.decode(lrequest.getParameter("expr") , "UTF-8");