LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading in unicode text

Dear all, I am trying to write a simple program to read in text from text files, store different texts (sentences) in an array of text files and then display the text in a text indicator. The code is meant to work like in the popular app duolingo to train student in translating texts. The problem is that the text I am importing has Swedish characters and are not being properly read by the loader. All the Swedish vowels are being misread by the system. An example of the problem can be seen in Textproblem.png. 

 

I read the article on activating Unicode

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YI52CAG&l=sv-SE

 

I activated Unicode in the Labview.ini. Even when I change the keyboard to swedish it does not work. I have also typed and copied and pasted the Unicode characters into the text file and it hasn't helped. I am saving the notepad file in the UTF-8 format and I have tried forcing all the various text controllers to  use unicode (from right clicking and clicking the option)

 

I am mainly doing this in Labview 2020 SP1 and have tried this on windows 10 and 11. Does anyone have any suggestions on how to both load the text in and keep the correct symbols and also how to get the "answer here" text controller to pass the correct symbols to the rest of the program (as seen by the element indicator.

 

I have attached the main program Duolingo2.Vi, Text2array.vi and two  text files that I am trying to import correctly into Duolingo2.vi

 

Regards

Robert

0 Kudos
Message 1 of 5
(619 Views)

Adding Unicode support for LabVIEW has been an issue for years.  If you do a Web search for "LabVIEW Unicode", you can see this is an ongoing issue, and that some progress (including some recent developments) might provide some help.

 

Bob Schor

0 Kudos
Message 2 of 5
(606 Views)

LabVIEW only handles UTF-16 LE, not UTF-8.

The attached VI's might be helpful.

 

In your labview.ini file, you must have the line:

UseUnicode=TRUE

 

With text objects in LabVIEW, whether the code are interpreted as ASCII or UTF-16 LE is a text attribute that is settable character-by-character.  To ensure that a string indicator will always display everything as Unicode, run this one time:

 

paul_a_cardinale_1-1713452750888.png

0 Kudos
Message 3 of 5
(572 Views)

Dear Paul, thank you very much for your message and programs. I think you have really put me on the right road.  I tried running the programs you sent  and labview began looking for a file called unicode strings.lvlib. Do you know where I can download this for labview 2020SP1?

 

This has moved me closer, when I saved the text file  as UTF+16 LE and this greatly improved the text display but it  still has some strange symbols at the beginning of the sentence. Do you feel that doing this direct conversion within the program will be better?

 

Regards

Robert

 

0 Kudos
Message 4 of 5
(527 Views)

@DrRob2020 wrote:

Dear Paul, thank you very much for your message and programs. I think you have really put me on the right road.  I tried running the programs you sent  and labview began looking for a file called unicode strings.lvlib. Do you know where I can download this for labview 2020SP1?

 

This has moved me closer, when I saved the text file  as UTF+16 LE and this greatly improved the text display but it  still has some strange symbols at the beginning of the sentence. Do you feel that doing this direct conversion within the program will be better?

 

Regards

Robert

 


Sorry.  "unicode strings.lvlib" is a library that I created.  I should have disconnected the VIs from that library before posting them.

Sometimes there's a menu item "Disconnect from Library" that you can use.  If that's not there, you can "Save As" to save a copy without being liked to the .lvlib.

0 Kudos
Message 5 of 5
(519 Views)