05-19-2010 07:03 PM
Hi all,
I'm having an issue whereby a .vi I've created to save string data sometimes saves the .txt file as ANSI and sometimes as Unicode. Unfortunately the unicode appears to be Chinese characters when opened in notepad. When I open the same file in notepad++ the data is there but in unicode format. I'd like to try and understand why this is happening and fix it. Any advice would be appreciated. I've included the .vi, ansi output example and a unicode output example.
Brief description of the vi functionality:
The .vi simply saves the input string to the filename (and path) supplied in Log File Path. It checks conditions for file existing, path exisiting and creates any missing pieces (folders, files). Then it opens the file for writing, sets 'append' and writes to the files. Lastly it closes the file.
I can not figure out what is causing it to sometimes save as unicode and sometimes as ansi. Please let me know if there is anything further I can provide.
Cheers,
Alex
05-19-2010 08:56 PM - edited 05-19-2010 09:00 PM
05-19-2010 11:30 PM
05-20-2010 04:06 AM
alexhunt wrote:Hi all,
I can not figure out what is causing it to sometimes save as Unicode and sometimes as ANSI. Please let me know if there is anything further I can provide.
Hi, alex,
The file seems to be saved correctly and its not saved as Unicode. The file opened as Unicode.
Do simple experiment:
1. Start Notepad:
2. Type 'AAAA BBB CCC DDDDD':
3. Save it. As you can see in hex viewer, my file is correct:
4. Now open this file in notepad, you will be surprised:
This is true for XP, not sure how it works with Windows 7.
Try to open your file in that way:
Andrey.