When building web applications one typically uses UTF-8 encoding thoughout to ensure that you can send and receive text in multi-byte languages such as Russian, and Chinese.
The Window 7 version of Tomcat is (insanely) not UTF-8 by default. This is because it picks up the default encoding from your installation of Java which is also not UTF-8 by default.
The appropriate Java environment variable must be set.
-
set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF8"
(from stackoverflow)
This can be done by putting an appropriate setenv.bat in \Tomcat 7.0\bin or by setting the variable in the Tomcat service dialogue.
It’s not insane. It does what it is supposed to – use the OS default character set.
Microsoft does not like to do what everyone else does, and uses their own character set as default.
Don’t blame Tomcat, or Java.
Using the Microsoft default, you can transmit and receive all sorts of strange characters. It just isn’t the international standard.
Pingback: java – Change Tomcat's Charset.defaultCharset in windows-ThrowExceptions – ThrowExceptions