eclipse中文乱码解决_解决git status显示中文文件名乱码问题

f799b1ad13a7c66eee93da330c63d468.png

使用 git status 查看本地有改动但未提交的中文文件名时,发现会显示为一串数字,没有显示中文的文件名。具体如下所示:

$ git status# 位于分支 master# 尚未暂存以备提交的变更:# (使用 "git add ..." 更新要提交的内容)# (使用 "git checkout -- ..." 丢弃工作区的改动)## 修改: "224257346216247345210266346265201.txt"

解决方案是设置 git 的 core.quotepath 选项为false:

git config --global core.quotepath false

查看git在线帮助手册 (https://git-scm.com/docs/git-config),里面对 core.quotepath 选项说明如下:

core.quotePath

Commands that output paths (e.g. ls-files, diff), will quote "unusual" characters in the pathname by enclosing the pathname in double-quotes and escaping those characters with backslashes in the same way C escapes control characters (e.g. t for TAB, n for LF, for backslash) or bytes with values larger than 0x80 (e.g. octal 302265 for "micro" in UTF-8). If this variable is set to false, bytes higher than 0x80 are not considered "unusual" any more. Double-quotes, backslash and control characters are always escaped regardless of the setting of this variable. A simple space character is not considered "unusual". Many commands can output pathnames completely verbatim using the -z option. The default value is true.

即,core.quotepath 选项为 true 时,会对中文字符进行转义再显示,看起来就像是乱码。设置该选项为false,就会正常显示中文。

在一些终端上还要检查它自身的语言设置,看终端是否可以正常显示中文。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值