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!