添加locale编码
- vi /var/lib/locales/supported.d/local
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_CN.GBK GBK
zh_CN GB2312
- sudo locale-gen
修改缺省的编码为zh_CN
- vi /etc/default/locale
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_CTYPE="zh_CN.UTF-8"
修改vim配置文件:
- vi /etc/vim/vimrc
set fileencodings=utf-8,gb2312,gbk,gb18030
set termencoding=utf-8
set encoding=prc
重启Ubuntu Server
- reboot
可以用locale看环境变量,查看是否设置OK
- locale