How to solve garbled characters in Linux

angryTom
Release: 2019-11-08 09:42:14
Original
5536 people have browsed it

How to solve garbled characters in Linux

garbled characters appear in Linux

How to set the Chinese language of the Linux system, this is what many friends ask when they start using Linux Sometimes, we will encounter a problem, that is, when the terminal input command is echoed, the Chinese characters are displayed as garbled characters. This situation usually occurs because the Chinese language pack is not installed, or there is a problem with the default language set. Taking centos as an example, how to check the language and set and modify the language when operating Linux

How to solve garbled characters in Linux

1. Check the current system language

Log in to the linux system After opening the operation terminal, enter echo $LANG to view the currently used system language. Such as

How to solve garbled characters in Linux

2. Check the installed language pack

How to solve garbled characters in Linux

Check whether there is a Chinese language pack You can enter the locale command in the terminal. If there is zh cn, it means that the Chinese language has been installed.

3. If there is no Chinese language,

can download and install the Chinese language package from the Internet. yum groupinstall chinese-support

How to solve garbled characters in Linux

After installation

enter the localecommand

How to solve garbled characters in Linux

4. How to modify the system language to Chinese

1 Temporarily change the language

If you only temporarily change the language environment of the Linux system, you can Set LANG=language name by inputting, for example, Chinese is LANG=zh_CN.UTF-8

2. Modify the system default language

The above method is to set the system default by modifying Language configuration

such as vi /etc/sysconfig/i18n (note to restart the system after making changes)

How to solve garbled characters in Linux

##5. Other notes

If setting and modifying the Chinese language according to the above method still does not work, pay attention to the encoding selected by your link terminal.

Take xshell as an example, select Chinese or UTF8 for the terminal encoding

How to solve garbled characters in Linux##cmd input chcp 65001 to switch to utf-8 encoding

Centos6 solution:

yum install fontconfig-devel 
yum groupinstall chinese-support
Copy after login

centos7 system:

yum install fontconfig-devel 
yum groupinstall fonts
Copy after login

Recommended:

linux server tutorial

The above is the detailed content of How to solve garbled characters 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template