Chinese garbled characters of Java processes on Unix platforms

Source: Internet
Author: User

Method 1: On Unix platforms. The printed Chinese characters are garbled characters. Which of the following are Chinese characters in the logs recorded using Log4j ?, This problem is annoying. Of course, with my luck, this problem will certainly happen. Now, record the solution as every application starts a Java Process, the startup method is java $ OPTS com. xxx. xxx. xxx (java-Ddefault. client. encoding = GBK-Dfile. encoding = GBK-Duser. language = Zh-jar load-data.jar) where the variable $ OPTS is the JVM startup parameter we want to set. Set the JVM character set here. The settings are as follows:-Ddefault. client. encoding = GBK-Dfile. encoding = GBK-Duser. language = Zh. After this is added, the garbled problem is basically fixed. If the problem persists, I cannot solve it. Log4j cannot use the preceding method to set Chinese garbled characters when logging to a file. The setting method is: Open the log4j. properties file and set the output character set in the file Appender. As follows: log4j. appender. buss. encoding = GBK Method 2: After www.2cto. comjdk15 ~ Create a fallback directory under/jre/lib/fonts/and bake the font you want to use in java into this directory. The following method is passed in fc6, assume that the user's jre path is/usr/java/jdk1.6.0 _ 03/jre/cd/usr/java/jdk1.6.0 _ 03/jre/lib/fontssudo mkdir fallback

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.