中文乱码处理

3 篇文章 0 订阅

有好几个地方:

1.JSP设置 contentType

2.Filter:utf8 request.setCharacterEncoding()

3.Tomcat server.xml:

<Connector useBodyEncodingForURI="true" />
 

 也可URIEncoding="UTF-8"

http://tomcat.apache.org/tomcat-7.0-doc/config/http.html

URIEncoding

This specifies the character encoding used to decode the URI bytes, after %xx decoding the URL. If not specified, ISO-8859-1 will be used.

 

可以用此参数,指定在使用%XX 解码URL 之后,用来解码URI的字符集。如果未指定,ISO-8859-1被使用。

useBodyEncodingForURI

This specifies if the encoding specified in contentType should be used for URI query parameters, instead of using the URIEncoding.This setting is present for compatibility with Tomcat 4.1.x, where the encoding specified in the contentType, or explicitly set using Request.setCharacterEncoding method was also used for the parameters from the URL. The default value is false .

 

此参数指定: 是否 URI查询参数(相当于GET请求参数吧) 中使用 JSP页面的contentType 编码 , 而不是 使用上面 URIEncoding定 的那个编码。这个设置兼容Tomcat4.1.x,就是说,在contentType中指定的 编码字符集,或用request.setCharacterEncoding方法指定 编码字符集,同样也用于URL传来的参 数。默认是=false的。

暂时先就这么标注下,下班了,有时间好好整理下

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值