Posted about 7 years ago. Visible to the public.

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

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

Copy
R<C3><BC>ckg<C3><A4>ngig # should be "Rückgängig"

However, not Git is to blame but the less command Archive 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).

Copy
$ 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.

Copy
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.

Flaky tests are tests that sometimes fail for no obvious reason. They are the plague of many end-to-end (E2E) test suites that automate the browser through tools like Capybara and Selenium.

Join our free training event and learn to fix any flaky test suite, even in large legacy applications.

Owner of this card:

Avatar
Arne Hartherz
Last edit:
about 7 years ago
by Arne Hartherz
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more