Cause: Since the JDK is an international version, at compile time, if we do not specify the encoding format of the Java source program with the-encoding parameter, Then Java.exe first get us to do the system default encoding format, that is, when compiling Java program, if we do not specify the source program file encoding format, the JDK first obtains the operating system's file.encoding parameter (it saves the operating system default encoding format, such as Win2K, his value is GBK), The JDK then translates our Java source program into memory from the file.encoding encoded format to the Java internal default Unicode format. After that, Javac compiles the converted Unicode file into a class file, At this point the. class file is Unicode encoded, it is placed in memory, and the JDK then saves this Unicode-encoded. class file into the operating system to form the. class file that we see. But when we compile without setting, the equivalent of using parameters: Javac-encoding GBK Xx.java, there will be incompatibilities.
Workaround: You should use the-encodin parameter to specify the encoding method: Javac-encoding UTF-8 Xx.java.
CMD command when compiling Java programs: Non-mapped characters encoded GBK