LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Unicode, Boolean Text vs Boolean Caption

Hello Labview community,

I am trying to implement the Unicode coding in my application using this set of Vis: \\National Instruments\LabVIEW 2022\vi.lib\addons\Tools\Unicode

Ideally I would like to use "Boolean texts" for my Boolean buttons but found that only the Caption option seems to be correctly translated into Unicode (Text1 in the attached VI). Has anyone else encountered the same issue? Is there a fix?

In case I use Caption I am running into the issue that the buttons are not clickable in the Caption area...

So either way I am stuck...

Thank you very much for any insight...

Christophe

0 Kudos
Message 1 of 24
(1,531 Views)

I don't know much about the Unicode VIs from NI. But yes, you can also change the boolean text to Unicode. Property Node is: BoolText.InterpAsUnicode.

 

0 Kudos
Message 2 of 24
(1,516 Views)

Hi Christophe,

 

I haven't tried opening your VI (I don't have LV2022 handy), but I think I know the problem you're describing. The boolean text of the control needs to be 'enabled' for Unicode - this can be done by copying and pasting some existing Unicode text over the boolean text (make sure UseUnicode=True is added to labview.ini for this to work). Here's some Unicode text to try copying: 안녕하세요. Once the button text has been enabled for Unicode, you can write to it using Update Boolean.vi from NI's Unicode Tool library.

 

Another technique I've found that works is to set the BoolText.Selection property before writing the text to the control. Note the string array needs to be UTF-16LE formatted. Here's a snippet:

write-boolean-text-unicode.png

 

If you're still running into issues, there's a Unicode library I'm working on called G-Unicode which handles boolean text plus a lot more:

g-unicode-multilingual.gif

 

Message 3 of 24
(1,498 Views)

Hello,

Thank you both for your answers. Few remarks:

-          Yes I had used the “UseUnicode=TRUE” switch in both my Labview and application .ini files

-          I do not see the BoolText.InterpAsUnicode property, at least in my Labview 2022 Q3. See attached picture.

-          “Enabling” the Boolean did indeed help but I do not understand the process very well. I did as you said by pasting a Korean string and it worked. I then restarted Labview, still working. I built an app and still it kept working. So enabling is just a one time operation? Where is this idea coming from, is it officially coming from NI? Is there another way of enabling a Boolean to Unicode?

 

Thank you again

Christophe

0 Kudos
Message 4 of 24
(1,472 Views)

The InterpAsUnicode property is private, and requires the SuperSecretPrivateSpecialStuff=True key in labview.ini.

 

The Unicode copy+paste trick is documented in the Unicode Tools thread (see the Create Digital Control.pdf attachment). A similar technique is required to enable Unicode text in tab controls, and in graph plot names. Enabling unicode text is a one time operation for boolean text and tab control text, but doesn't seem to persist for graph plot names.

 

The only other technique I've found for writing Unicode boolean text is to change the text selection prior to writing the Unicode text, as shown in the snippet in my previous post. This method doesn't require copy+paste.

Message 5 of 24
(1,461 Views)

Thanks again, very precious info !

Is there another trick to use Unicode texts in conjunction with native dialog functions of Labview such as ‘Two Button’ dialog?

0 Kudos
Message 6 of 24
(1,450 Views)

Not that I'm aware of. I've tried various encodings + byte order marks with those dialog functions without any luck. You might need to roll your own.

 

The G-Unicode library I mentioned earlier does have a message box function which displays a system dialog with Unicode title + text, plus one, two or three buttons, and an icon. The button text can't be set programmatically (yet), but there are a few standard default choices (yes/no, OK/cancel, etc):

Dataflow_G_0-1692723233696.png

Running the above will display a system dialog with Unicode title + text:

Dataflow_G_1-1692723335510.png

 

 

0 Kudos
Message 7 of 24
(1,440 Views)

Ok in this case I prefer to build my own 'Two Buttons' dialog 😉

Another thing that I cannot figure out is how Labview interprets a Unicode Text file exported from Excel. In the attached picture you see that many 'special' characters that Notepad sees pretty well are either missed or badly decoded in Labview...

0 Kudos
Message 8 of 24
(1,430 Views)

LabVIEW's file I/O functions aren't Unicode aware so Read Text File doesn't do any special character handling, and can mess with line endings in UTF-16 encoded text when the Convert EOL right-click option is checked.

 

Can you attach both the Excel spreadsheet and the exported Unicode Text file? If you open the text file in Notepad++ what does the encoding say in the bottom right (ANSI, UTF-8, UTF-16LE)? It might also be worth trying to export the spreadsheet using LibreOffice, as it has more text encoding options.

 

Another thing I've noticed is when writing Unicode to LabVIEW's string controls, tab characters aren't displayed in the correct location and instead appear at the end of the string. This appears to be a LabVIEW limitation, and is why the spacing is messed up. I suspect if you highlight all the text in that second string control, there'll be a bunch of tab characters hiding at the end.

 

And for what it's worth, G-Unicode can automatically detect and handle the string encoding when read from a file. The detection is based on byte order mark (if present), statistical tests (via IsTextUnicode), and UTF-8 byte sequences. Here's a screenshot of one of the included examples:

Dataflow_G_0-1692753284662.png

 

0 Kudos
Message 9 of 24
(1,410 Views)

You are aware that the IsTextUnicode() API is badly broken since ever? It will return bad status with certain patterns of text..

Rolf Kalbermatter
My Blog
Message 10 of 24
(1,376 Views)