Perforce + Unicode = Eplic Fail

Just created a Visual Studio Add-in using the wizard. The source files created by the wizard turned out to be UTF-16. The files I create manually are UTF-8. It is all fine until you check in UTF-16 files into Perforce. It sees line endings like this: 0D 00 0A 00 and “fixes” them by inserting an extra 0D, making it 0D 00 0D 0A 00.

This, of course, screws up a UTF-16 file royally: you get a file full of some Kanji characters. I actually had to write a program that undoes that deed and manually change file encoding to UTF-8. Ouch.

Leave a Reply

Your email address will not be published. Required fields are marked *