Characters encoding wrong in terminal using git

2019-05-25 20:21发布

问题:

Any time I try to make a "git diff" command to see a file change, it shows me problem in special characters, like accented ones, but if I see the file with "cat" it shows me everything ok. I am using Ubuntu 12.04 LTS.

ex:

WHERE  `T<C3><A9>cnico` IS NOT NULL

I tried to put these lines in .gitconfig, close terminal e open again, but still didn't work.

[i18n]
    logoutputencoding = utf8
    commitencoding = utf8

Anyone have other suggestion?

回答1:

Make sure of your git version.

For Ubuntu12.0.4 (precise), the package search for git indicates a:

git-core (1:1.7.9.5-1) 

And i18n issues have been addressed in git1.7.10+ (see "git, msysgit, accents, utf-8, the definitive answers").