mrfr
mrfr

Reputation: 1794

UTF-8 encoding error. Git pull wont apply fix

On our site we had an UTF-8 encoding error. So we manually changed back all characters to their right ones. Now I did git pull without errors, but the characters are still wrong? I even did git reset --hard origin/master to point to the latest commit that have these changes. But they still remain.

I am starting to think that it might be something wrong with my editor visual code but in settings I have: "files.encoding": "utf8" and on site I have <meta charset="UTF-8">.

What can be causing this?

EDIT:

Glömt Lösenord becomes this:

enter image description here

Upvotes: 0

Views: 1071

Answers (1)

max630
max630

Reputation: 9238

You can inspect the contents of file stored in git with the following command:

git cat-file -p <commit>:<path> | xxd -g1

There is no transformation in the command so it should always accurately show what is the content.

The xxd utility is bundled with Git for windows fir windows, in Linux distributions it can be in own packet or part of vim packet. You could also try od command from coreutils but it's output seems less convenient to read.

The "Glömt Lösenord" should look like:

echo Glömt Lösenord|xxd -g1
0000000: 47 6c c3 b6 6d 74 20 4c c3 b6 73 65 6e 6f 72 64  Gl..mt L..senord
0000010: 0a

Upvotes: 2

Related Questions