Linux Centos7设置UTF-8编码,防止中文乱码

#

locale

LANG=zh_CN.gb2312

LC_CTYPE="zh_CN.gb2312"

LC_NUMERIC="zh_CN.gb2312"

LC_TIME="zh_CN.gb2312"

LC_COLLATE="zh_CN.gb2312"

LC_MONETARY="zh_CN.gb2312"

LC_MESSAGES="zh_CN.gb2312"

LC_PAPER="zh_CN.gb2312"

LC_NAME="zh_CN.gb2312"

LC_ADDRESS="zh_CN.gb2312"

LC_TELEPHONE="zh_CN.gb2312"

LC_MEASUREMENT="zh_CN.gb2312"

LC_IDENTIFICATION="zh_CN.gb2312"

LC_ALL=

# cp /etc/locale.conf /etc/locale.conf.bak

 

修改/etc/locale.conf文件为:

#vim /etc/locale.conf

# cat /etc/locale.conf

LANG="zh_CN.UTF-8"

系统重启

#reboot