解决get url中文参数值是奇数个时是乱码的问题
JSP:
?
<a href="javascript:location.href=encodeURI('${path}/user_list.action&username=中文&userdesc=斯巴达')">链接</a>
也可以单独编码:
<a href="javascript:location.href='${path}/user_list.action&username=encodeURI(中文)&userdesc=encodeURI(斯巴达)'">链接</a>
?
Action:
?
username = new String(username.getBytes("ISO-8859-1"),"UTF-8");userdesc = new String(userdesc .getBytes("ISO-8859-1"),"UTF-8");
?
这样参数值不管是偶数个汉字还是奇数个汉字,都能得到正确中文参数值?
?
?
?