Re: [PATCH/RFC 1/1] Auto diff of UTF-16 files in UTF-8

2018-02-27 Thread Jeff King
On Mon, Feb 26, 2018 at 06:27:06PM +0100, tbo...@web.de wrote: > @@ -3611,8 +3615,25 @@ int diff_populate_filespec(struct diff_filespec *s, > unsigned int flags) > s->size = size; > s->should_free = 1; > } > - } > - else { > +

Re: [PATCH/RFC 1/1] Auto diff of UTF-16 files in UTF-8

2018-02-26 Thread Peter Krefting
tbo...@web.de: +static inline int buffer_has_utf16_bom(const void *buf, size_t len) { + const unsigned char *text = (unsigned char *)buf; + if (!text || len < 2) +return 0; + if (text[0] == 0xff && text[1] == 0xfe) +return 1; + if (text[0] == 0xfe && text[1] == 0xff) +return 1;

[PATCH/RFC 1/1] Auto diff of UTF-16 files in UTF-8

2018-02-26 Thread tboegi
From: Torsten Bögershausen When an UTF-16 file is commited and later changed, `git diff` shows "Binary files XX and YY differ". When the user wants a diff in UTF-8, a textconv needs to be specified in .gitattributes and the textconv must be configured. A more user-friendly diff