项目中有一个 alert乱码问题,按照网上的方法改了很久不没反应,结果最终突然灵机一动想到了服务器的编码,结果ok了 ,花了好长时间阿,囧
虽然项目全部采用了UTF-8编码,所有的源文件*.java,*.jsc,*.html,*.ftl都采用了UTF-8编码。可是还是出现了乱码问题。很是不爽,后来找到了tomcat,和resin的配置。
- Tomcat的配置。(conf/server.xml)
<!--</span><span style="COLOR: rgb(0,128,0)"> Define a non-SSL HTTP/1.1 Connector on port 8080 </span><span style="COLOR: rgb(0,128,0)">-->
<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.