Read more

How to fix: "git diff" does not show umlauts (or other non-ASCII characters) properly

Arne Hartherz
December 10, 2014Software engineer at makandra GmbH

When using git diff, you might encounter weird characters where umlauts (or any other UTF-8) characters should be. It looks like this:

R<C3><BC>ckg<C3><A4>ngig # should be "Rückgängig"
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

However, not Git is to blame but the less command Show archive.org snapshot that Git uses to page your diff output.

You need to tell less to use UTF-8 (otherwise it tries to convert multibyte chars like "ü" which is represented by 2 bytes C3 and BC).

$ LESSCHARSET=UTF-8 git diff

Doing it like above should fix it for that one command. If you want to persist that setting, say the following.

export LESSCHARSET=UTF-8

Put it into your ~/.bashrc and reopen all terminals (or source ~/.bashrc in open terminals).


Note that if you are having trouble with filenames, you should try changing git's core.precomposeunicode config setting.

Posted by Arne Hartherz to makandra dev (2014-12-10 10:12)