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

Linux server java output file is garbled in Chinese

王林
Release: 2019-11-02 15:29:28
Original
3725 people have browsed it

Linux server java output file is garbled in Chinese

Use the following statement to check the encoding:

String encoding = System.getProperty("file.encoding");
Copy after login

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"
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template