LabVIEW

cancel
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
(9,066 Views)
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
0 Kudos
Message 2 of 15
(9,041 Views)
can you send an example please?

Paul
0 Kudos
Message 3 of 15
(9,029 Views)
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.
 
James T
0 Kudos
Message 4 of 15
(9,017 Views)
You didn't post any VI in your first message.
0 Kudos
Message 5 of 15
(9,013 Views)
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


Paul
Message 6 of 15
(9,006 Views)
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
(8,944 Views)
James: I've run into the same issue (reading unicode text files), but don't have LabView 9. Could you post "uni-string-read.vi" as a version readable with LabView 8.0?

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

Thanks!
0 Kudos
Message 8 of 15
(8,828 Views)
mscorlib.dll in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

Paul
Message 9 of 15
(8,816 Views)
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).


Message 10 of 15
(8,812 Views)