2

I'm looking for the answer for strange character in git show like in the screen:

git show command

I have the same issue in git diff.

my .gitconfig file:

[user]
    name = user
    email = user@user.com
[difftool "sourcetree"]
    cmd = '' \"$LOCAL\" \"$REMOTE\"
[mergetool "sourcetree"]
    cmd = "'' "
    trustExitCode = true
[credential "https://...."]
    provider = generic
[core]
    editor = code --wait
[diff]
    tool = vscode
[difftool "vscode"]
    cmd = "code --wait --diff $LOCAL $REMOTE"

Edited: I found the answer here : https://stackoverflow.com/a/36692549/12733938 but what strange it works for almost all files. Some still have same strange letter but for now is ok.

MarFor9
  • 21
  • 2
  • 5
  • Does this answer your question? [Git ignore BOM (prevent git diff from showing byte order mark changes)](https://stackoverflow.com/questions/27223985/git-ignore-bom-prevent-git-diff-from-showing-byte-order-mark-changes) – AD7six Jul 12 '22 at 11:48
  • Actually I think that's more likely related to your terminal setup - not being a windows user though I am not sure. – AD7six Jul 12 '22 at 11:53
  • I am facing the same problem. Any solution yet? I tried changing the encoding in VS Code to use UTF-8 with and without BOM, but no luck yet. – tarekahf Oct 18 '22 at 04:42

1 Answers1

1

The file you had committed in git is not UTF-8 encoded. It looks like UTF-16 LE BOM encoding which is typically in windows. So you have to change the encoding to UTF-8 to fix your "strange character" problem.

KrysGo
  • 61
  • 3
  • I am facing the same problem. Any solution yet? I tried changing the encoding in VS Code to use UTF-8 with and without BOM, but no luck yet. – tarekahf Oct 18 '22 at 04:41