I could not find a VI to read unicode text files - this one reads unicode on the assumption that it contains plain text. Might help someone struggling with unicode text files produced by some applications. Enhancements welcome.
LabVIEW is natively ASCII, but you have a few options here. Probably the easiest is to work with ASCII in LabVIEW and use a ASCII-to-Unicode converter outside of LabVIEW to change the files. You may also be able to call the converter from within LabView using the System Exec.vi. Another option is to work with ASCII in LabVIEW and use the Write Binary File.vi to write a binary file that is representative of Unicode. This would probably be more tedious.
Brian R. District Sales Manager Washington DC National Instruments
I posted a VI (attached to the original message) that reads a unicode text file like the example attached to this reply, containing the following text:
TThis1 TThis2 TThis3
I found that some applications (& web sites which produce data) are now standardizing on unicode text format - this will become more pervasive in future. The LabVIEW VI "Read from Text File" can only read plain ASCII text so this VI sits on top to convert unicode text into plain text. However it is assumed that the unicode does not contain any non-standard ASCII characters, but flags the presence of non-standard characters if they are found.
I don't know where I got this, but found it when I needed to do some Unicode conversion from the registry.
In the library, the particular VI I found of interest was Convert UTF16 String To ASCII.vi If you used regular Read From Binary File and used U16 as your type, then passed the array into this, it should convert into the proper ASCII string.
It uses the WinAPI to do conversions. So there shouldn't be any surprises (assumign your using Windows).