带有法国口音的Git消息 [英] Git messages with french accents

查看:42
本文介绍了带有法国口音的Git消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常使用法语消息(包括UTF-8口音)来提交个人项目.

I use to commit my personnal projects with french messages, including UTF-8 accents.

我当时在Linux Arch安装上处理这些项目,然后将它们拉到另一个新的Arch安装上.

I was working on these projects on a Linux Arch install, and then pulled them on another new Arch install.

但是现在,当我想查看其中一个项目的git log时,它不能正确显示法语口音.

But now when I want to look at the git log of one of these projects, it doesn't render the french accents correctly.

具有选定提交的示例:

$ git log -n1 --pretty=format:"%h %s" 8e72413
8e72413 Ajout<C3><A9> le param<C3><A8>tre TabStop

但是当我用cat用管道传输它时,它就像一个符咒:

But when I pipe it with cat, it works like a charm:

$ git log -n1 --pretty=format:"%h %s" 8e72413 | cat
8e72413 Ajouté le paramètre TabStop

当我使用Vim使用以下类似命令读取它时,它也很好用:

It works well too when I read it using Vim, using the following similar command:

:r! git log -n1 --pretty=format:"%h %s" 8e72413

如果我使用xtermurxvt,并且我的语言环境设置使用LANG=fr_FR.UTF-8进行了正确的配置(以及我以前工作的旧安装),也会发生相同的问题.当然,在没有这个问题的情况下,使用相同的存储库,我以前的Arch安装仍然可以正常工作.

The same problem is happening if I use either xterm or urxvt, and my locale settings are well configured (as well with my old install on which I was working), with LANG=fr_FR.UTF-8. Of course, my old Arch install is still working well, without this issue, with the same repository.

我想念什么?我真的不记得要在旧安装程序上执行任何操作才能使其正常运行.

What did I miss? I really don't remember anything I could have done on my old install to make it work properly.

推荐答案

问题是我的语言环境配置没有很好地配置:

The problem is that my locale config was not so well configured :

$ locale
LANG=fr_FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=

我没有看到要点:LC_ALL未设置为fr_FR.UTF-8.

I didn't see the important point : LC_ALL was not set to fr_FR.UTF-8.

实际上,这个问题比这更为琐碎:我只是忘了添加了以下别名:alias git='LANG=en_US.UTF-8 git'

Actually, the problem was more trivial than that : I just forgot that I added the following alias: alias git='LANG=en_US.UTF-8 git'

实际上,更改LC_ALL的值不是解决方法.

Indeed, changing the value of LC_ALL is not a solution.

之所以使用这个别名,是因为vim-fugitive与以法语显示的git不能很好地配合使用.

I made this alias because vim-fugitive is not working well with git displayed in french language...

这篇关于带有法国口音的Git消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆