Subject: Re: 25.1.50; file with chinese/japanse chars, vc-diff fails (HG, Git, RCS)

From: Eli Zaretskii <[email-masked]>
Date: Mon, 23 May 2016 21:15:57 +0300

> Cc: Uwe Brauer <[email-masked]>, Dmitry Gutov <[email-masked]>,
>  Eli Zaretskii <[email-masked]>
> From: Paul Eggert <[email-masked]>
> Date: Mon, 23 May 2016 10:40:40 -0700
> 
> I tried something like the following, which as I understand it is the 
> procedure recommended for putting UTF-16 files under Git control on 
> GNU/Linux hosts (the basic idea is that the repository contains UTF-8 
> and the working files contain UTF-16):
> 
> * Add the line 'test-chin-jap.tex filter=utf16' to .gitattributes.
> 
> * git config filter.utf16.clean 'iconv -f utf-16 -t utf-8'
> 
> * git config filter.utf16.smudge 'iconv -f utf-8 -t utf-16'
> 
> * Commit the file all over again (as this stores the UTF-8 version in 
> the repository, not the UTF-16 version).
> 
> * Make a trivial edit to the file in the non-ASCII region.
> 
> When I did all all this, Emacs 24.5 works and draft Emacs 25 shows 
> mojibake, so we indeed have a regression. The shell command 'git diff' 
> works fine, and outputs the difference in UTF-8, but I guess draft Emacs 
> 25 treats the git diff output as UTF-16.

If the above is the recommended procedure for putting such files under
Git, then vc-git should bind coding-system-for-read to utf-8 whenever

  (coding-system-get buffer-file-coding-system :ascii-compatible-p)

returns nil.  Otherwise, the current binding is TRT.