LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Caption.Text in a Chinese or Vietnamese

Solved!
Go to solution

1) In labview diagram, if Unit=US, then Txt="Faulty Trigger Detection Threshold", if Unit=VN, then Txt ="Ngưỡng phát hiện lỗi đầu đo"
2) Assigned Txt to the "Caption.Text" Node Property
3) Font is set to Arial Unicode MS
4) Control Panel > Region > Language > Windows display language = Tiếng Việt (I have 2 languages packs installed: English and Tiếng Việt) When I run my Labview, if Unit = US, the Caption reads "Faulty Trigger Detection Threshold", however, if Unit = VN, the Caption reads weird incognizable characters.

Running Windows 11 and Labview 32 bit 21.0.1
I looked at this link: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YIFDCA4&l=en-US but that is for previous Windows version, Windows 11 language setting has much less options.

please help

0 Kudos
Message 1 of 17
(318 Views)

ngthai_0-1732640288055.png

I do have these 2 lines in Labview.ini:
UseUnicode=TRUE
SuperSecretPrivateSpecialStuff=TRUE

ngthai_1-1732640412351.png

My main interest is changing the Caption (not the string value, but I update string value here as well just to show you all my problem):
If TXT1 is set to Vietnamese, then the String Value shows correctly, but not the caption. However, when set to English, the string value is supposed to reads "Faulty Trigger ..." but it is displaying weird characters.

For TXT2, if I set Vietnamese, both the Value and the Caption read wrong. Supposed to be "Ngưỡng phát hiện lỗi đầu đo"




0 Kudos
Message 2 of 17
(269 Views)
Solution
Accepted by topic author ngthai

The property "Force Unicode Text" only affects keyboard entry,

Displayed text is affected by the text property "Interpret as Unicode".  This property is like font attributes in that it can be different for different characters in the string.  When writing to that property it only affects the selected text.

Executing the following one time will set the caption to always interpret data as UTF-16 LE.

paul_a_cardinale_0-1732647787576.png

Message 3 of 17
(249 Views)

Thank you Paul,

Solution works.

Now I have 2 new problems: 
1) Caption 1 is actually in SETUP tab. Text 2 actually in FEATURE tab. When I change box 3 in Advance tab, the caption 1 and text 2 will be temporarily overlapping ugly like this. I had to click on any other tab, then come back to ADVANCE tab, then the overlapping would disappear.
2) Text 2 is not displaying the right Vietnamese (I do use InterpAsUnicode). I had to create a blank option on Box 3 to select (to blank out all the captions, and use same setting for InterpAsUnicode) then go back to Box 3 to Select Vietnam, in order for text 2 to display in the right Vietnamese language. Why?

ngthai_0-1732878642009.png
on problem 1: if I don't switch to different tab, and keep changing to different options on box 3, then all the captions and texts will eventually overlapping like this:

ngthai_1-1732882216827.png

 

 

0 Kudos
Message 4 of 17
(195 Views)

@ngthai wrote:

Thank you Paul,

Solution works.

Now I have 2 new problems: 
1) Caption 1 is actually in SETUP tab. Text 2 actually in FEATURE tab. When I change box 3 in Advance tab, the caption 1 and text 2 will be temporarily overlapping ugly like this. I had to click on any other tab, then come back to ADVANCE tab, then the overlapping would disappear.
2) Text 2 is not displaying the right Vietnamese (I do use InterpAsUnicode). I had to create a blank option on Box 3 to select (to blank out all the captions, and use same setting for InterpAsUnicode) then go back to Box 3 to Select Vietnam, in order for text 2 to display in the right Vietnamese language. Why?

ngthai_0-1732878642009.png
on problem 1: if I don't switch to different tab, and keep changing to different options on box 3, then all the captions and texts will eventually overlapping like this:

ngthai_1-1732882216827.png

 

 


I suspect that all your problems are due to InterpAsUnicode not begin applied to all the characters.

Doing this, one time, before sending any text to the caption, should have worked:paul_a_cardinale_0-1732886368768.png

But another technique is to do this:

paul_a_cardinale_1-1732886564369.png

 

Message 5 of 17
(186 Views)

Thank you. Problem #2 solved (using your suggestion to use Selection.End=9999).
However, problem #1 still exists (the captions keep appearing temporarily on the wrong tab) if I start the VI on "Page 2" tab. It appears if I start the VI on "Page 1" tab, then it's OK. Attached here is a simple VI.

ngthai_0-1732961416782.png

 

0 Kudos
Message 6 of 17
(169 Views)

So I conclude that this is Labview problem. Because if I remove InterpAsUnicode element out of the property node, then there is no overlapping text (showing up on wrong tab pages) problem (but of course, it will not show the correct unicode texts in certain languages).
Is there a way to solve this Labview "refresh" problem?

0 Kudos
Message 7 of 17
(165 Views)
Solution
Accepted by topic author ngthai

It's a very old bug in LabVIEW that was never fixed.

I found a workaround (see attachment).

Some notes:

  1. You had the text selection and InterAsUnicode in the wrong order (set text selection 1st).  Setting them in the wrong order may usually work, but won't necessarily work.
  2. You shouldn't have your while loop spinning pointlessly (I added an event case).
Message 8 of 17
(146 Views)

Need help again with this topic. Really appreciate all your help.
I use reference to string indicators (in an array) so that I can use the same property across multiple labview VI. I even added InterpAsUnicode twice. English, German, French (with F=InterpAsUnicode) are all good. Chinese and Vietnamese are displaying incorrectly (T = InterpAsUnicode).

ngthai_0-1733689566406.png
It is noted that each of my value is assembled by Concatenate, with the component value is dependent on other conditions.

ngthai_1-1733690074158.png
For example, English would be:
V2 
loose 
SEVERE
and it would display correctly as V2 loose SEVERE
Chinese would be: 
V2 
松动 
严重
so I expect the result to be: V2 松动 严重
but the result shows up as: ㉖縠ꡧ⁒严重‮ 
which only the last part is correct.

 

 

0 Kudos
Message 9 of 17
(98 Views)

I wanted to add that if I probe the components (obviously, probing will not show the right font), but just to give you more info, the probing results of the components are:
V2
~g¨R
%NÍ‘
and the concatenated string is V2 ~g¨R %NÍ‘ and as I mentioned, it displays as ㉖縠ꡧ⁒严重‮ 

On other non-concatenated string, it displays correctly, e.g., 排除此击打 (F10 切换排除与保留)
But I need concatenations, as my string components are dependent on various factors; and it also need to have V2 (or F10) in English.

0 Kudos
Message 10 of 17
(94 Views)