Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure git encoding for German Umlaute on Ubuntu and Windows?

I noticed that commit messages that contain German Umlaute are not displayed correctly when I run git log in Git Bash on Windows. Those commits were made on Ubuntu using the Terminal. Normally, commit messages are written in English but when it comes to names there is no way around, e.g. Added library by Simon Jünker. I guess it can also be Git Bash which cannot handle the character encoding. But maybe there is a setting to force utf-8 encoding for writing and displaying text in any module (Git Gui, Git k) of Git.

What is your multi-platform character encoding setup for Git? Please, make sure to include the configuration for both platforms in your answer. You can also add MacOS.

like image 985
JJD Avatar asked Apr 14 '11 13:04

JJD


2 Answers

This link showed the way to solve this issue:

Please try:

set LESSCHARSET=UTF-8

in the Windows command Shell (cmd.exe) and run the git commands again.

like image 159
Helmut Darmüntzel Avatar answered Sep 25 '22 09:09

Helmut Darmüntzel


Try to set git config on GIT Bash prompt with one of the following commands:

git config --global i18n.commitEncoding utf8
git config --global i18n.commitEncoding cp1252

If somone in your team uses another encoding, you will have a missmatch. Petra uses utf8:

git commit -m "Petras message with umlaut ÄäÜüÖöß etc."

Karl uses cp1252:

git commit -m "Karls message with umlaut ÄäÜüÖöß etc."

Sara checks out the pushed branch and depending on her encoding she will see one of the messages wellformed and the other missformed.

git config --global i18n.commitEncoding utf8
git log -n 2 --oneline
    Petras message with umlaut ÄäÜüÖöß etc.
    Karls message with umlaut <C4><E4><D6><F6><DC><FC><DF> etc.

git config --global i18n.commitEncoding cp1252
git log -n 2 --oneline
    Petras message with umlaut ÄäÜüÖöß etc.
    Karls message with umlaut ÄäÜüÖöß etc.
like image 35
Seymi Avatar answered Sep 23 '22 09:09

Seymi