Recently encountered the problem of Chinese garbled, Eclipse encoding environment set is UTF-8, external is also to UTF-8 encoding for the transfer, but encountered in Chinese, or because garbled and produced a series of errors. On the Internet a lot of information, found that this is related to the code of the JVM, the JVM by default refers to the computer operating system encoding format to encode (most of the Chinese Win XP system encoding format is GBK), so the JVM compiled Java into a class file will be compiled in GBK way. You will find that some machines will always be garbled, and some machines will not
Get JVM Code:
Import Java.nio.charset.Charset; Public class Testcharset { publicstaticvoid main (string[] args) { System.out.println ("JRE Version:" + system.getproperty ("java.version")); System.out.println ("JVM code:" + Charset.defaultcharset ());} }
J2SE Setting the JVM encoding:
Java EE settings encoding:
Http://blog.sina.com.cn/s/blog_a1eac6d60100yzfo.html