JavaScript form提交汉字乱码
<script type="text/javascript"> var test1="http://www.w3school.com.cn/My first/" document.write(encodeURI(test1)
+ "<br />") document.write(decodeURI(test1)
) </script>
输出
http://www.w3school.com.cn/My%20first/ http://www.w3school.com.cn/My first/
java后台解码
String name=request.getParameter("name");
(1) resultMsg = URLEncoder.encode(name, "utf-8");
name = java.net.URLDecoder.decode(name,"UTF-8");
(2) new String(request.getParameter("name").getBytes("ISO8859_1"),"UTF-8")