Use the following statement to check the encoding:
String encoding = System.getProperty("file.encoding");
The result output: ANSI_X3.4-1968, resulting in garbled Chinese characters.
Solution:
Check the server system code through locale, need to modify:
1. Add -Dfile to the tomcat startup script .encoding=UTF-8
Option
2. Modify the configuration file so that the following environment variables have the following values:
LANG="en_US.UTF-8" LC_ALL="en_US.UTF-8"
You can use the locale command to test.
3. Restart the server.
Recommended tutorial: java tutorial
The above is the detailed content of Linux server java output file is garbled in Chinese. For more information, please follow other related articles on the PHP Chinese website!