在Windows中更改Tomcat的Charset.defaultCharset [英] Change Tomcat's Charset.defaultCharset in windows
本文介绍了在Windows中更改Tomcat的Charset.defaultCharset的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在windows 7中使用tomcat 6.0.32。
在一个非常简单的servlet中,在init方法中,我打印:
I'm using tomcat 6.0.32 in windows 7. Inside a very simple servlet, inside the init method, I'm printing:
System.out.println(Charset.defaultCharset());
输出为:
windows-1253
据我所知,这是tomcat开始的JVM,因为我在独立的java类中打印相同的内容,我得到UTF8作为响应。
As far as I understand this is how tomcat start's in the JVM since I'm printing the same in standalone java class and I get "UTF8" as a response.
那么,如何将它改为UTF-8?
So, how can I change this to UTF-8?
感谢
推荐答案
只需在TOMCAT / bin目录中创建一个 setenv.bat 文件,其中包含以下内容:
Just create a setenv.bat file inside the TOMCAT/bin directory with the following contents:
set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF8"
这篇关于在Windows中更改Tomcat的Charset.defaultCharset的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文