Why does Git treat this text file as a binary file?

It simply means that when git inspects the actual content of the file (it doesn’t know that any given extension is not a binary file – you can use the attributes file if you want to tell it explicitly – see the man pages).

Having inspected the file’s contents it has seen stuff that isn’t in basic ascii characters. Being UTF16 I expect that it will have ‘funny’ characters so it thinks it’s binary.

There are ways of telling git if you have internationalisation (i18n) or extended character formats for the file. I’m not sufficiently up on the exact method for setting that – you may need to RT[Full]M 😉

Edit: a quick search of SO found can-i-make-git-recognize-a-utf-16-file-as-text which should give you a few clues.

Leave a Comment