ssh中如果修改了所有的编码方式,但是最后还是在数据库中显示乱码,怎么解决?

 

在server.xml中,添加

URIEncoding="UTF-8"

1.如果使用的是自带的MyEclipse Tomcat

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

 

 

2.若果用的是Tomcat 7.0:

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

 

如果在修改了以后,启动项目报了错:

org.xml.sax.SAXParseException: Content is not allowed in trailing section.

原因是:XML内容不正确,比如多个空格,换行等等。需要仔细排查;

 

posted @ 2017-02-20 16:51  小女人~大智慧  阅读(581)  评论(0编辑  收藏  举报