The problem is,
(a) In order that commit messages appear correctly in gitk
(my colleagues work in gui), everytime I "git commit", I have to
:set fileencoding=UTF-8
in vi.
(b) When I "git log", less(1) cannot display
non-ascii characters. It displays raw codes <E6><80><BB>...,
that look like the UTF-8 encodings of the characters.
Since git gui commit and view work fine, I guess it is only a set-up problem.
How to set it up correctly?
yn
I suspect there's no way to do this as Git bash does not know about
UTF-8.
The things which can alleviate your problem are:
First, set i18n.logOutputEncoding config option for your local
repository to "cp936" so that `git log` will convert commit messages to
this encoding on output. If this won't work, try setting it to the
respective "OEM codepage" (you probably know that Windows uses
different encodings for non-unicode GUI apps and non-unicode console
apps).
To alleviate the pain of producing commit messages encoded in UTF-8, you
could locally set the core.editor config options to something like
'gvim --cmd "set enc=utf-8"'
Alternatively, you could locally set i18n.commitEncoding config
option to your preferred codepage which would save you from messing
with the editor settings. This has one downside: in this case Git won't
convert your commit messages to UTF-8 but will instead record them as is
while adding a special metadata header to the commit message specifying
the encoding from that setting.
In theory, this should work, but I'd better discuss this with
your co-workers beforehand and test it before deploying.
Some details on this problem are also in [1].