3 ms·
By "unicode support" I mean here on Windows 10 PC I’d like "git log -p" print to the PowerShell those changed lines + line numbers, like it works with ASCII fil
by Const-me 11y ago
By "unicode support" I mean here on Windows 10 PC I’d like "git log -p" print to the PowerShell those changed lines + line numbers, like it works with ASCII files.
- viraptor 11y agoThat can be handled by gitattributes already. Something like this should help: [diff "the_file_extension"] textconv = the_conversion_tool binary = true You just need to find/write the conversion utility you need. iconv could do that with `iconv -f UTF-16 -t your-terminal-encoding`
- Const-me 11y agoNo it can’t, because of the following two things: (1) Not all source or text files are Unicode, I can’t assign an extension. (2) I’m running Windows, I don’t have terminal, I use git from power shell. And power shell’s native encoding is already UTF-16.
- dkuntz2 11y agoPowershell is a terminal?
- viraptor 11y agoAs mentioned in other comments - powershell terminal is your terminal. As for the issue - if you can't define what files have what encoding, how do you expect git to know it? What you can do is apply the binary filter I posted to all files and write a script which attempts to guess encoding and then translates that to utf16 with iconv. But expect funny failures from time to time (sometimes more than one decode may be valid)
- Const-me 11y ago“if you can't define what files have what encoding” — I can, but not by name or extension. See this: http://unicode.org/faq/utf_bom.html#bom1 http://unicode.org/faq/utf_bom.html#bom1 “you can do is apply the binary filter I posted to all files and write a script” — yes, I know git is open source and very flexible. But Unicode is 20 years old standard widely accepted by the industry. Git should support Unicode out of the box, without my custom scripts.