解決ubuntu中文顯示亂碼問題
阿新 • • 發佈:2019-02-05
新增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