Is there any way to make git gui
display and show diffs for UTF16 files somehow?
I found some information, but this is mostly referring to the command l
This method is for MSysGit 1.8.1, and is tested on Windows XP. I use Git Extensions 2.44, but since the changes are at the Git level, they should work for Git Gui as well. Steps:
Install Gnu Iconv.
Create the following script, name it astextutf16
, and place it in the /bin directory of your Git installation (this is based on the existing astextplain
script):
#!/bin/sh -e
# converts Windows Unicode (UTF-16 / UCS-2) to Git-friendly UTF-8
# notes:
# * requires Gnu iconv:
# http://gnuwin32.sourceforge.net/packages/libiconv.htm
# * this script must be placed in: ~/Git/bin
# * modify global ~/Git/etc/gitconfig or local ~/.git/config:
# [diff "astextutf16"]
# textconv = astextutf16
# * or, from command line:
# $ git config diff.astextutf16.textconv astextutf16
# * modify global ~/Git/etc/gitattributes or local ~/.gitattributes:
# *.txt diff=astextutf16
if test "$#" != 1 ; then
echo "Usage: astextutf16 " 1>&2
exit 1
fi
# -f(rom) utf-16 -t(o) utf-8
"\Program Files\GnuWin32\bin\iconv.exe" -f utf-16 -t utf-8 "$1"
exit 0
Modify the global ~/Git/etc/gitconfig or your local ~/.git/config file, and add these lines:
[diff "astextutf16"]
textconv = astextutf16
Or, from command line:
$ git config diff.astextutf16.textconv astextutf16
Modify the global ~/Git/etc/gitattributes or your local ~/.gitattributes file, and map your extensions to be converted:
*.txt diff=astextutf16
Test. UTF-16 files should now be visible.