虽然项目全部采用了UTF-8编码,所有的源文件*.java,*.jsc,*.html,*.ftl都采用了UTF-8编码。可是还是出现了乱码问题。很是不爽,后来找到了tomcat,和resin的配置。
-
Tomcat的配置。(conf/server.xml)
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
< Connector port ="80" maxHttpHeaderSize ="8192"
maxThreads ="150" minSpareThreads ="25" maxSpareThreads ="75"
enableLookups ="false" redirectPort ="8443" acceptCount ="100"
connectionTimeout ="20000" disableUploadTimeout ="true" URIEncoding ="UTF-8" /> -
Resin的配置。(conf/resin.conf)
character-encoding
Resin 1.1 child of: resin, server, host-default, host, web-app-default, web-app
default: The default value is ISO-8859-1.
Specifies the default character encoding for the environment.
<web-app id='/'>
<character-encoding>shift_jis</character-encoding>
...
</web-app>
这个是resin doc里面的我是在web-app-default里面加上了encoding的配置
<
web-app-default
>
< character-encoding > UTF-8 </ character-encoding >
</ web-app-default >
< character-encoding > UTF-8 </ character-encoding >
</ web-app-default >
希望对你的项目有帮助。