首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

web使用中文乱码的解决

2012-08-26 
web应用中文乱码的解决?1)post请求可通过过滤器解决,在web.xml里增加filter:filterdescription字符集

web应用中文乱码的解决

?1)post请求可通过过滤器解决,在web.xml里增加filter:

<filter><description>字符集设置过滤器</description><filter-name>encodingFilter</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param></filter>

?

2)get请求可通过修改tomcat配置解决,修改conf/server.xml:

<Connector port="80" protocol="HTTP/1.1"                connectionTimeout="20000"                redirectPort="8443" URIEncoding="UTF-8" />

?

3)对于通过url调用外部系统,通过get方式传中文参数,如果对方系统不是UTF-8字符集,而是GBK等其它中文字符集,则可以对参数事先进行相应字符集进行编码,否则浏览器会默认对参数进行UTF-8编码,这样对方系统就会出现乱码问题。

热点排行