{"thread":{"id":"52958","subject":"Re: Feature request: number of added and deleted lines for UTF-16 files","startedAt":"2020-03-08T21:38:16Z","lastAt":"2020-03-09T18:35:37Z","messageCount":2,"participants":["Александр Третьяк","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"392956","messageId":"CACDhn-R6ZKvgMxJdxP7NpsAViY97PfC7aM8xTJgaQK_GLJRyvQ@mail.gmail.com","threadId":"52958","inReplyTo":"CACDhn-QHqGFhZw+3K61v+Qtmm5y35nARWJaBkZ_YyZevJu8HBQ@mail.gmail.com","subject":"Re: Feature request: number of added and deleted lines for UTF-16 files","fromName":"Александр Третьяк","fromEmail":"alextretyak2@gmail.com","sentAt":"2020-03-08T21:37:56Z","receivedAt":"2020-03-08T21:38:16Z","isPatch":false,"sender":{"key":"alextretyak2@gmail.com","avatar":null},"body":"Some source files in MSVC (e.g. resource.h) are encoded in UTF-16 (LE)\nwith Byte Order Mark (i.e. signature: FF FE for little-endian and FE\nFF for big-endian), and `git diff --numstat` shows `-` in place of\nnumber of added/removed lines, e.g.:\n-       -       clientapp/resource.h\n\nCan you auto detect UTF-16 by reading first 2 bytes of the file, and\ncorrectly show number of lines added/removed?\n"},{"id":"392969","messageId":"20200309183532.lsh74dxjlxdqhdox@tb-raspi4","threadId":"52958","inReplyTo":"CACDhn-R6ZKvgMxJdxP7NpsAViY97PfC7aM8xTJgaQK_GLJRyvQ@mail.gmail.com","subject":"Re: Feature request: number of added and deleted lines for UTF-16 files","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2020-03-09T18:35:32Z","receivedAt":"2020-03-09T18:35:37Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On Mon, Mar 09, 2020 at 07:37:56AM +1000, Александр Третьяк wrote:\n> Some source files in MSVC (e.g. resource.h) are encoded in UTF-16 (LE)\n> with Byte Order Mark (i.e. signature: FF FE for little-endian and FE\n> FF for big-endian), and `git diff --numstat` shows `-` in place of\n> number of added/removed lines, e.g.:\n> -       -       clientapp/resource.h\n>\n> Can you auto detect UTF-16 by reading first 2 bytes of the file, and\n> correctly show number of lines added/removed?\n\nThere is an attribute \"working-tree-encoding\" that can be used to\nhave the files in \"UTF-16LE-BOM\" (in your case) in your working tree\nand in UTF-8 inside the repo.\nThis will allow commands like \"git diff\" to display added/deleted lines\nin UTF-8.\n\nMore details may be found here:\nhttps://git-scm.com/docs/gitattributes\n\nI hope that helps\n"}]}