First, install the Chinese language pack:
yum groupinstall chinese-support
Then modify the character encoding configuration. If there is no such file, create it:
vim /etc/sysconfig/i18n
(Recommended tutorial: centos usage tutorial)
The modified content is as follows:
LANG=”zh_CN.GB18030″ SUPPORTED=”zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en” SYSFONT=”latarcyrheb-sun16″
i18n file is used to set the system language, such as: zh_CN.UTF-8, zh_CN.GB18030, zh_TW .Big5, en_US.UTF-8, etc.
There are three environment variables in i18n:
LANG variable, which sets the system language.
SUPPORTED variable determines the language supported by the system, that is, the language that the system can display.
SYSFONT variable represents the system font.
Finally restart the server:
reboot
Recommended related video tutorials: linux video tutorial
The above is the detailed content of Chinese characters display garbled characters under centos system. For more information, please follow other related articles on the PHP Chinese website!