LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from text file respect special characters (tildes)

Solved!
Go to solution

Hello, I am using Read from text file to read a text in Spanish. The problem is when there is a "tilde", that is a special character to make the accent. The text is something like this:

 

Identificación de la producción

 

And I get

 

IdentificÃ3 n de la producciÃ3 n. It sometimes change also to Ã-. What should I do?

0 Kudos
Message 1 of 3
(236 Views)

I tried the following "experiment" -- I captured your string "Identificación de la producción", pasted it into a LabVIEW 2021 (32-bit) String constant, and then wrote the following small program:

Spanish accents.png

When I ran it, it produced a Text file that I named "Spanish accents.txt" and that contained "Identificación de la producción" (I copy/pasted the text into the pair of quotation marks).

 

But here's the thing -- it depends on what editor I use to look at the file.  I have several text editors on my PC.  One is extremely old -- maybe >40 years (and no longer available), while the (including Notepad++) are still being maintained.  The "old" editor returned the symbol "less than or equal" (which I'm not sure how to insert here, looks like "<" with a line below the "<"), while the others returned "ó", letter "o" with acute accent.

 

So it might be that LabVIEW is "doing the right thing", but your PC is using another character mapping for accented characters ...

 

Bob Schor

Download All
Message 2 of 3
(206 Views)
Solution
Accepted by topic author electronic_lab

your text file is not 8-bit ASCII code but UTF-8 (8-bit Unicode). LabVIEW text is 8-bit ASCII using whatever codepage your regional settings are configured for.

 

There are different ways to deal with it:

- Search for Unicode LabVIEW libraries and convert the byte string read from your file to ASCII.

-Make sure the writing application is writing ASCII text instead of UTF-8.

- Enable the Unicode token in your LabVIEW.ini file but be aware that that is still experimental Alpha functionality with several bugs.

Rolf Kalbermatter
My Blog
Message 3 of 3
(205 Views)