This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Bug: read/write a Unicode file
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 08, 2014
08:58 AM
Bug: read/write a Unicode file
Hi,
I'm using InstallShield 2013 Premier with SP1.
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);
ListReadFromFile(listID,szFile);
ListWriteToFile(listID,szFile);
ListDestroy(listID);
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).
Seems like a bug to me.
Any idea how to resolve, or at least workaround this issue?
I'm using InstallShield 2013 Premier with SP1.
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);
ListReadFromFile(listID,szFile);
ListWriteToFile(listID,szFile);
ListDestroy(listID);
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).
Seems like a bug to me.
Any idea how to resolve, or at least workaround this issue?
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 09, 2014
10:35 AM
Unfortunately there's confusion to what the term "Unicode" means. In a Windows context it often means specifically UTF-16-LE, and in files typically requires the UTF-16 BOM be present on the file. This is the meaning of Unicode used in the description of the InstallScript functions. In this context, UTF-8 is not exactly considered Unicode, although sometimes a UTF-8 signature/BOM can elicit the behavior you need.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 12, 2014
04:35 AM
Thanks Michael,
Indeed, if I convert the file to UCS-2 (UTF-16) LE, the code works fine.
I would appreciate if you could add it to the documentation.
Indeed, if I convert the file to UCS-2 (UTF-16) LE, the code works fine.
I would appreciate if you could add it to the documentation.
![](/skins/images/3B39CE851FDD5528C393F146EB70A2D0/responsive_peak/images/icon_anonymous_message.png)