url传汉语言参数乱码

url传中文参数乱码
我的url中文乱码的解决方案:

客户端对url进行两次转码:(str可能是中文)

Js代码
...
var url = ;
url = encodeURI(url);
url = encodeURI(url);
...

js通过encodeURI编码  通过decodeURI解码


服务器段对参数值进行解码:


Java代码
HttpServletRequest request = ServletActionContext.getRequest();
String str= request.getParameter("str");
str = java.net.URLDecoder.decode(str,"UTF-8");
...