Home  >  Article  >  Operation and Maintenance  >  How to solve the Chinese garbled problem in Linux

How to solve the Chinese garbled problem in Linux

清浅
清浅Original
2019-03-08 13:49:3924347browse

Solution to Chinese garbled characters in Linux: For example, when log4j is garbled, we can find the configuration file and set the character encoding to utf-8. If Linux does not have a Chinese language pack installed, you can install a Chinese language pack to solve the problem.

We often encounter a lot of Chinese garbled problems under Linux. Today I will share with you some common solutions, which have certain reference value. I hope it will be helpful to everyone

How to solve the Chinese garbled problem in Linux

##[Recommended course: Linux tutorial]

mysql Chinese garbled code

vi /etc/my.cnf

Add

under mysqld

[mysqld]
character-set-server=utf8

tomcat Chinese garbled code

Find tomcat/conf/sever.xml

Insert URIEncoding="UTF-8" in the tag below

<Connector port="9999" URIEncoding="UTF-8" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

log4j garbled code

The configuration file used, insert

log4j.appender.A1.Encoding=UTF-8

Linux has no Chinese language package## in the configuration file #View the current language

locale

Install Simplified Chinese

yum install kde-l10n-Chinese

Modify the configuration file etc/locale.conf

LANG="zh_CN.UTF-8"

In addition, the default time zone is not China, eat here Too bad, so I changed the time zone to Shanghai, Asia

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

Summary: The above is the entire content of this article, I hope it will be helpful to everyone.

The above is the detailed content of How to solve the Chinese garbled problem in Linux. 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