Home  >  Article  >  Operation and Maintenance  >  How to solve garbled output in Linux

How to solve garbled output in Linux

尚
Original
2019-12-31 13:31:313370browse

How to solve garbled output in Linux

Linux Chinese garbled characters may be caused by the Chinese language package not being installed.

1. Check whether the Chinese language pack is installed

#locale -a |grep "zh_CN"

If there is no output, it is not installed. You can install it first, use the following command You can install it:

# yum -y groupinstall chinese-support

Modify the configuration file

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

Or, edit the /etc/profile configuration file and add the following line

export LANG="zh_CN.UTF-8"

Reload

# . /etc/profile

Related article tutorial sharing: linux tutorial

The above is the detailed content of How to solve garbled output 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