First check whether the Chinese language pack is installed on your system. You can use the locale -a command to list all available locale environments:
Check if there are the following four items:
If there is, there is no need to install it. If not, you need to reinstall it.
The command is as follows:
yum install kde-l10n-Chinese
(Recommended tutorial: centos tutorial)
Then modify i18n and locale. conf configuration file
1, vim/etc/sysconfig/i18n, add the following two lines of code in it:
LANG="zh_CN.UTF-8" LC_ALL="zh_CN.UTF-8"
Then execute it to make the The modified file takes effect:
source/etc/sysconfig/i18n
2, vim /etc/locale.conf
Add: LANG="zh_CN.UTF-8"
Execute the same operation to make the newly modified file take effect:
source /etc/locale.conf
Recommended related video tutorials: linux video tutorial
The above is the detailed content of Chinese characters under centos are always garbled. For more information, please follow other related articles on the PHP Chinese website!