Unicode files and InstallShield

I’ve prepared a little test – an InstallScript MSI project that executes the following code:

szFile = TempFolder ^ "web.config"; // A UTF-8 file
listID = ListCreate (STRINGLIST);

Despite the claim that “if the file already exists and the pre-existing file is Unicode, it writes the file as Unicode”, the resulting file is actually ANSI, with two strange characters at the beginning of the file (I assume this is due to the Unicode BOM).

Turns out that InstallShield only supports the UCS-2/UTF-16 LE encoding (the native Windows Unicode implementation). Hence UTF-8 files are not supported.

Bottom line: when processing Unicode files using InstallScript, make sure they are properly encoded!