1

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

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

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

Example with a choosen commit:

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

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

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

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

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.

yolenoyer
  • 8,797
  • 2
  • 27
  • 61

1 Answers1

2

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=

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


EDIT:

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'

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

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

yolenoyer
  • 8,797
  • 2
  • 27
  • 61
  • sorry for digging up that old topic, but I have exactly the same problem and can't manage to solve it. When I try to do `git log --graph --all --date=relative --pretty=tformat:'%Cred%h%Creset %s %Cgreen(%an %ad)%Creset'` , I get `* f79f360 Cre le serveur d'API avec les rgles de validation (J.M. Clry 22 minutes ago)`. I've tried all the solutions above, like setting all my locales to **fr_FR.UTF-8**, and even tried to use an alias : `alias git='LANG=fr_FR.UTF-8 git'` but my messages still appears with these strange characters. Any help appreciated. – jmpp Aug 13 '20 at 00:52
  • @jmpp If you tried all the solutions on this thread, then you should ask a new question, maybe by adding a link to here; indeed comments are not designed for this. It will also add visibility to your problem, compared to this very old thread. – yolenoyer Aug 13 '20 at 06:21
  • Well, after other researches, I've found my solution which was to remove all the declarations in my **.zshrc** and run a `sudo dpkg-reconfigure locales`, and chose "fr_FR-UTF-8" when proposed. Running the git log command after that gave me the message with the accents. – jmpp Aug 13 '20 at 09:01