[size=large]0.想深入研究编码,乱码问题请看[url]http://p2world.iteye.com/blog/617078[/url][/size]
[size=large]1.request.setCharacterEncoding(编码名);规则:[/size]
[list]
[*]只对post起作用
[*]必须在本次会话的任何request.getParameter()之前设置
[/list]
[size=large]2.对于get提交的 request.getParameter()[/size]
[list]
[*]必须在容器(tomcat)中全局设置(server.xml 设置URIEncode)
[/list]
[size=large]3.javaScript是UTF-8编码 所以:[/size]
[list]
[*]ajax也是UTF-8的
[*]encodeURI()也是UTF-8的
[/list]
[size=large]4.Ajax提交乱码终极解决:[/size]
[list]
[*]对提交的数据 多 encode 1遍
[*]在java端按一下方法获取参数
[/list]
[size=large]5.深入研究推荐工具:httpWatch pro (http转包工具)[/size]
[size=large]1.request.setCharacterEncoding(编码名);规则:[/size]
[list]
[*]只对post起作用
[*]必须在本次会话的任何request.getParameter()之前设置
[/list]
[size=large]2.对于get提交的 request.getParameter()[/size]
[list]
[*]必须在容器(tomcat)中全局设置(server.xml 设置URIEncode)
[/list]
<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="GBK"/>
[size=large]3.javaScript是UTF-8编码 所以:[/size]
[list]
[*]ajax也是UTF-8的
[*]encodeURI()也是UTF-8的
[/list]
[size=large]4.Ajax提交乱码终极解决:[/size]
[list]
[*]对提交的数据 多 encode 1遍
[*]在java端按一下方法获取参数
[/list]
java.net.URLDecoder.decode(request.getParameter(),"utf-8");
[size=large]5.深入研究推荐工具:httpWatch pro (http转包工具)[/size]