Search code examples
gitencodingutf-8git-fetch

git fetch changes german umlauts


I have multiple git repositories that are all utf-8 encoded and display umlauts correctly. I want them to be combined into a single repo (each original repo is a single branch in the new one). My system is configured to use utf-8 as the default git encoding. I do the following steps:

git init test (initializes as utf-8)
cd test
git remote add test_remote C:/temp/remote_repo
git fetch --all
git checkout -b test_local test_remote/master

After that, i have the remote branch master in the local branch test_local with all commits. My problem is, that the german umlauts aren't shown correctly, but git log gives something like ü for ü.

My question is, why does git fetch change encodings and why isn't it shown correctly in the new repo, as it is also utf-8?

I attached an example of how i fetch the remote repo and the commit message changes while the commit hash stays the same: Git Bash Screenshot


Solution

  • At first i tried to change the codepage of my windows command line by executing chcp 65001. As that didn't work, i tried to set the os language for programs that do not support unicode to utf-8 but that didn't work either.

    After a long search, i discovered that the problem was in the source repository, where git config --list showed, that i18n.commitencoding is set to some windows encoding. After switching it to utf-8, everything works perfect now.