在Controller中接收到的POST参数如果是中文的话,显示为乱码.已知客户端传过来时编码为UTF-8. 问题产生分析: spring MVC中默认的编码格式为“ISO-8859-1”,因此造成乱码. 简单的解决方式: New String(request.getParameter("xxx").getBytes("iso-8859-1"),"utf-8") 最好的解决方式: 在web.xml中配置Spring字符过滤器,添加: <!-…
解决方法 function getQueryString(key){ var reg = new RegExp("(^|&)"+key+"=([^&]*)(&|$)"); var result = window.location.search.substr(1).match(reg); return result?decodeURIComponent(result[2]):null; } 下面的这种方法获取到url中的中文参数是乱码 /*fu…