I have a file with unicode symbols (russian text).
When I fix some typo I use git diff --color-words=.
to see the changes I've done.
In case of unicode (cyrillic) symbols I get some mess with angle brackets like so:
$ cat p1
привет
$ cat p2
Привет
$ git diff --color-words=. --no-index p1 p2
diff --git 1/p1 2/p2
index d0f56e1..d84c480 100644
--- 1/p1
+++ 2/p2
@@ -1 +1 @@
<D0><BF><9F>ривет
It looks like git diff --color-words=.
is checking the difference between bytes and not between symbols as I expect.
Is there any way to tell git
to work properly with unicode symbols?
UPD about my environment: I get the same on Mac OS and on Linux host.
My shell vars are:
BASH=/bin/bash
HOSTTYPE=x86_64
LANG=ru_RU.UTF-8
OSTYPE=darwin10.0
PS1='\h:\W \u\$ '
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
TERM=xterm-256color
TERM_PROGRAM=iTerm.app
_=-l
I have reset git config to default settings like so:
$ git config -l
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
git version
$ git --version
git version 1.7.3.5
git diff
showing you "angle brackets" but ratherless
- the default pagergit diff
calls. Try exportingLESSOPTS=-R
orLESSOPTS=-RX
and see if this helps. There's also a problem with your question: you tell us precisely zero information about your environment.$ git config --global core.pager "less -R"
and this does not help.$ GIT_PAGER='' git diff --no-index --color-words=. p1 p2
���ривет
$ GIT_PAGER='' git diff --no-index --color-words=. --no-color p1 p2
п�ривет
--word-diff-regex=.
works on byte level and breaks multi-byte character. Sadly this option does not support codepoint range either (tried posix and pcre notation but none worked).