Home >Java >javaTutorial >Linux server java output file is garbled in Chinese

Linux server java output file is garbled in Chinese

王林
王林Original
2019-11-02 15:29:283735browse

Linux server java output file is garbled in Chinese

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:mybatis like queryNext article:mybatis like query

Related articles

See more