Add locale encoding
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
Modify the default encoding to 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"
Modify the vim configuration file:
vi /etc/vim/vimrc
set fileencodings=utf-8,gb2312,gbk,gb18030 set termencoding=utf-8 set encoding=prc
Restart Ubuntu Server
reboot
You can use locale to see the environment variable to see if it is set OK
locale