日期:2014-05-16 浏览次数:20769 次
1.前台传值乱码
?
?? 前台JavaScript转码:
???
... var url = "reg?userid=" + str; url = encodeURI(url); url = encodeURI(url); ...
?
?? 后台解码:
?
... String userId = request.getParameter("userid"); userId = java.net.URLDecoder.decode(id,"UTF-8"); ...
?
??? 前台2次转码,后台一次
?
2.后台传值乱码
?
... response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); ...
?
??? 转码必须放在前面