当前位置: 代码迷 >> Web前端 >> get提交中文后乱码的有关问题的解决
  详细解决方案

get提交中文后乱码的有关问题的解决

热度:223   发布时间:2012-08-24 10:00:21.0
get提交中文后乱码的问题的解决

首先,encodeURIComponent对参数值 编码,要经过两次编码:
location.href = "productAction_searchInfoByType?searchSth=" + encodeURIComponent(encodeURIComponent(b));

java后台端一次解密

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

  相关解决方案