Home  >  Article  >  Operation and Maintenance  >  What to do if Chinese characters are displayed as garbled characters in Linux

What to do if Chinese characters are displayed as garbled characters in Linux

王林
王林Original
2020-05-15 13:43:203512browse

What to do if Chinese characters are displayed as garbled characters in Linux

1. Install the Chinese language pack. The command is as follows:

# yum -y groupinstall chinese-support

2. Set the corresponding character set

## 临时生效 
# export LANG="zh_CN.UTF-8"    # 设置为中文 
# export LANG="en_US.UTF-8"    # 设置为英文,我比较喜欢这样 export 
  
## 永久生效, 编辑/etc/sysconfig/i18n(最好reboot一下) 
LANG="zh_CN.UTF-8"
  
## 或者,编辑 /etc/profile配置文件,添加如下一行 
export LANG="zh_CN.UTF-8"

3. Reload the configuration file

# . /etc/profile

Done! In this way, Chinese characters will not be displayed with garbled characters.

Recommended tutorial: linux tutorial

The above is the detailed content of What to do if Chinese characters are displayed as garbled characters 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