Linux中文编码乱码 vim shell svn

0.原因分析

默认编码不对,语言包没有安装

1.查看安装的语言包

执行locale -a | grep zh

zh_CN
zh_CN.eucCN
zh_CN.GB18030
zh_CN.GB2312
zh_CN.GBK
zh_CN.UTF-8
zh_HK
zh_HK.Big5HKSCS
zh_HK.UTF-8
zh_TW
zh_TW.Big5
zh_TW.UTF-8

如果没有zh_CN之类的,先安装语言包
macOS自带
Ubuntu 执行sudo apt-get install language-pack-zh-hans-base

2.设置环境变量

执行export LC_ALL='zh_CN.UTF-8'
然后将这代码导入的~/.zshrc~/.bashrc(具体是看用哪个shell)
执行locale查看效果

LANG=en_US.UTF-8
LANGUAGE=en_US:
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=zh_CN.UTF-8

svn,shell乱码问题解决

3.vim乱码

.vimrc中加入

"乱码问题
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8

参考

http://stackoverflow.com/questions/11300633/svn-cannot-set-lc-ctype-locale
http://www.jianshu.com/p/Rww1Tp

你可能感兴趣的:(技术应用,软件使用方法)