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

How to solve the Chinese garbled problem in Linux

清浅
Release: 2019-03-08 13:49:39
Original
24406 people have browsed it

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

Add

under mysqld

[mysqld]
character-set-server=utf8
Copy after login

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

log4j garbled code

The configuration file used, insert

log4j.appender.A1.Encoding=UTF-8
Copy after login

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

locale
Copy after login

Install Simplified Chinese

yum install kde-l10n-Chinese
Copy after login

Modify the configuration file etc/locale.conf

LANG="zh_CN.UTF-8"
Copy after login

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

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!

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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template