Showing results for 
Search instead for 
Did you mean: 

Reading unicode text file

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.
James T
0 Kudos
Message 1 of 15
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  Another option is to work with ASCII in LabVIEW and use the Write Binary 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
0 Kudos
Message 2 of 15
can you send an example please?

0 Kudos
Message 3 of 15
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:
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.
James T
0 Kudos
Message 4 of 15
You didn't post any VI in your first message.
0 Kudos
Message 5 of 15
Possible.  You just want to be able to read them? see attached image. Well for windows anyway.

Message Edited by Stradis on 08-23-2007 01:07 AM

Message 6 of 15
Thanks for the suggestions - finger trouble - here is the VI attached.  Hopefully.  Thanks for the alternate Windows only solution!
James T
0 Kudos
Message 7 of 15
James: I've run into the same issue (reading unicode text files), but don't have LabView 9. Could you post "" as a version readable with LabView 8.0?

Stradis: What assembly/constructor is the "StreamReader" function in?

0 Kudos
Message 8 of 15
mscorlib.dll in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

Message 9 of 15
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  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).

Message 10 of 15