2006-11-20
tomcat and resin服务器如何设为UTF8编码
(转自http://leaf.jdk.cn/article.asp?id=39)
虽然项目全部采用了UTF-8编码,所有的源文件*.java,*.jsc,*.html,*.ftl都采用了UTF-8编码。可是还是出现了乱码问题。很是不爽,后来找到了tomcat,和resin的配置。
<web-app-default>
<character-encoding>UTF-8</character-encoding>

</web-app-default>
虽然项目全部采用了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>希望对你的项目有帮助。
发表评论
- 浏览: 68470 次
- 性别:

- 来自: 北京

- 详细资料
搜索本博客
最新评论
-
Java中文问题及最优解决方 ...
<script type="text/javascript"> alert ...
-- by youngsailer -
(hibernate)inverse,casca ...
很好啊,谢谢!
-- by elesen -
tomcat and resin服务器如 ...
resin 设置会有问题吧
-- by beauty9235 -
jsp中的四种范围(page|r ...
请教一下 如何在自定义标签里pageContext.setAttribute,然 ...
-- by blu3leaf -
提高JSP应用程序运行速度 ...
恩,对jsp的性能有帮助。
-- by leonardleonard






评论排行榜