* Re: Feature request: number of added and deleted lines for UTF-16 files
[not found] <CACDhn-QHqGFhZw+3K61v+Qtmm5y35nARWJaBkZ_YyZevJu8HBQ@mail.gmail.com>
@ 2020-03-08 21:37 ` Александр Третьяк
2020-03-09 18:35 ` Torsten Bögershausen
0 siblings, 1 reply; 2+ messages in thread
From: Александр Третьяк @ 2020-03-08 21:37 UTC (permalink / raw)
To: git
Some source files in MSVC (e.g. resource.h) are encoded in UTF-16 (LE)
with Byte Order Mark (i.e. signature: FF FE for little-endian and FE
FF for big-endian), and `git diff --numstat` shows `-` in place of
number of added/removed lines, e.g.:
- - clientapp/resource.h
Can you auto detect UTF-16 by reading first 2 bytes of the file, and
correctly show number of lines added/removed?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Feature request: number of added and deleted lines for UTF-16 files
2020-03-08 21:37 ` Feature request: number of added and deleted lines for UTF-16 files Александр Третьяк
@ 2020-03-09 18:35 ` Torsten Bögershausen
0 siblings, 0 replies; 2+ messages in thread
From: Torsten Bögershausen @ 2020-03-09 18:35 UTC (permalink / raw)
To: Александр Третьяк
Cc: git
On Mon, Mar 09, 2020 at 07:37:56AM +1000, Александр Третьяк wrote:
> Some source files in MSVC (e.g. resource.h) are encoded in UTF-16 (LE)
> with Byte Order Mark (i.e. signature: FF FE for little-endian and FE
> FF for big-endian), and `git diff --numstat` shows `-` in place of
> number of added/removed lines, e.g.:
> - - clientapp/resource.h
>
> Can you auto detect UTF-16 by reading first 2 bytes of the file, and
> correctly show number of lines added/removed?
There is an attribute "working-tree-encoding" that can be used to
have the files in "UTF-16LE-BOM" (in your case) in your working tree
and in UTF-8 inside the repo.
This will allow commands like "git diff" to display added/deleted lines
in UTF-8.
More details may be found here:
https://git-scm.com/docs/gitattributes
I hope that helps
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-09 18:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CACDhn-QHqGFhZw+3K61v+Qtmm5y35nARWJaBkZ_YyZevJu8HBQ@mail.gmail.com>
2020-03-08 21:37 ` Feature request: number of added and deleted lines for UTF-16 files Александр Третьяк
2020-03-09 18:35 ` Torsten Bögershausen
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).