Git17 webstorm中git中文乱码

用着webstorm+git bash,用着好好看,突然发现git的提交记录中的中文全都变成乱码或者十六进制编码的样子了:

<E6><B7><BB>

咋地了?

估计是前一阵子给webstorm化妆,装了个materialUI的插件搞的,在网上找了教程,解决问题:

修改git配置

在git命令下,分别输入:

文件提交编码格式

git config --global i18n.commitencoding utf-8

log输出的编码格式

git config --global i18n.logoutputencoding utf-8

界面编码格式

git config --global gui.encoding utf-8

然后git bash的乱码OK了,但是在webstorm中的git提交信息和terminal中的中文还是乱码,go on

webstorm设置

settingAppearance&BehaviorAppearance中,按下图设置,原来的主题用的字体对中文支持不好,导致git提交记录中文乱码:

image

但是在terminal中输入git log -2查看提交记录,还是中文乱码,go on

webstorm配置

找到IDEA在本地的安装路径,找到idea.exe.vmoptions文件和idea64.exe.vmoptions文件,在其最后一行添加

-Dfile.encoding=UTF-8

然后修改git安装路径下的bash.bashrc文件,在文件最后添加

export LANG="zh_CN.UTF-8"
export LC_ALL="zh_CN.UTF-8"

搞定!

参考

猜你喜欢

转载自blog.csdn.net/duola8789/article/details/80974677
今日推荐