Change Tomcat's Charset.defaultCharset in windows

I'm using tomcat 6.0.32 in windows 7. Inside a very simple servlet, inside the init method, I'm printing:


The output is:


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.

So, how can I change this to UTF-8?



Just create a setenv.bat file inside the TOMCAT/bin directory with the following contents:

set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF8"

You may also add this setting in the Tomcat 7.0 windows service manager.

from Dr James Bayley's blog

For Tomcat running as a Windows service neither %JAVA_OPTS% and neither setenv.bat answers works in my case.

I set the option "-Dfile.encoding=UTF8" in registry:

"HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\tomcatstackTomcat\Parameters\Java --> Options*

Then it works.

Try setting the (Windows) environment variable JAVA_TOOL_OPTIONS to -Dfile.encoding=UTF-8 and start the Tomcat Server.

Will get more idea from this link: Setting the default Java character encoding

Need Your Help

assigning self to CLLocationManager.delegate generates incompatible type warning

iphone xcode warnings cllocationmanager

The App I am current working on for some time now with no build errors has, since upgrading to xCode 4, been giving me an incompatible type warning for the last line of this code...

How can I block comment code in the IPython notebook?

ipython ipython-notebook

I have defined a function in an IPython notebook and would like to be able to block comment a section of it. Intuitively, I'd expect to be able to highlight a section of code, right click and have...