方案一
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");
方案三
html頁面:
function testTwo() {
var url = "testTwo.action?expr="+你好;
window.location.href= encodeURI(encodeURI(url));
}
後臺java代碼:
string name =HttpUtility.UrlDecode(Request.QueryString["name"].ToString());