windows下更改Tomcat的Charset.defaultCharset [英] Change Tomcat's Charset.defaultCharset in windows

查看:49
本文介绍了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

据我所知,这是 JVM 中 tomcat 的启动方式,因为我在独立的 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆