Skip to content

Japanese text displayed incorrectly when running git diff in version 2.11.0 #981

@nyoro712

Description

@nyoro712
  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options
git version 2.11.0.windows.1
sizeof-long: 4
machine: x86_64

I'm using a portable release: PortableGit-2.11.0-64-bit.7z.exe

  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 6.1.7601]

Windows 7 Professional, Service Pack 1, 64-bit

  • What options did you set as part of the installation? Or did you choose the
    defaults?

I have no install-options.txt file.

  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

I'm using diff-highlight.
I downloaded diff-highlight file from https://github.com/git/git/tree/master/contrib/diff-highlight and put it in %PathToPortableGit%\usr\bin\ directory.

.gitconfig

[core]
	autocrlf = false
	quotepath = false
[pager]
	log = diff-highlight | less
	show = diff-highlight | less
	diff = diff-highlight | less
[diff]
	compactionHeuristic = true

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Bash

  1. Build a test repository.
$ mkdir gitrepo
$ cd gitrepo
$ git init
$ touch test.txt
  1. Rewrite test.txt as following, and save with BOM-less UTF-8 encoding.
+日本語のテキスト
+Write in Japanese
+
  1. Add test.txt to the repository.
$ git add .
$ git commit -m "First commit"
  1. Rewrite test.txt as following.
-日本語のテキスト
-Write in Japanese
+英語のテキスト
+Write in English
  1. Now run git diff
$ git diff head
  • What did you expect to occur after running these commands?
$ git diff head
diff --git a/test.txt b/test.txt
index 19ebe7c..e45d453 100644
--- a/test.txt
+++ b/test.txt
@@ -1,2 +1,2 @@
-日本語のテキスト
-Write in Japanese
+英語のテキスト
+Write in English
  • What actually happened instead?
$ git diff head
diff --git a/test.txt b/test.txt
index 19ebe7c..e45d453 100644
--- a/test.txt
+++ b/test.txt
@@ -1,2 +1,2 @@
-<E6><97><A5><E6><9C><AC><E8><AA><9E><E3><81><AE><E3><83><86><E3><82><AD><E3><82><B9><E3><83><88>
-Write in Japanese
+<E8><8B><B1><E8><AA><9E><E3><81><AE><E3><83><86><E3><82><AD><E3><82><B9><E3><83><88>
+Write in English

Additional Notes

  • It worked correctly when I used version 2.10.2.windows.1
  • I did not change any config when updating to version 2.11.0.windows.1 from 2.10.2.windows.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions