LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Doug's first nugget -- Unicode

Don’t expect too many nuggets in the near future; I don’t know anything that you guys don’t already know.  I found something that I think might help anyone that needs to use Unicode, so this is my time to payback to the community for all the years I have been helped.

 

When I first started my journey to display Chinese, I was pointed to this article.

https://decibel.ni.com/content/docs/DOC-10153

 

This method causes you to use subvi’s to display Unicode characters on a button or anything else.  The biggest issue I have is more code that I have to add just to display Unicode.  The other issue is I want to be able to place both English and Chinese in the same button.  The method in the link is to set “UseUnicode=True” in the LabVIEW.ini file.

 

Unicode.jpg'

 

What I have found is LabVIEW does not seem to handle Unicode very well, so let windows handle it.  By default UseUnicode is not even in the LabVIEW.ini file, so it is not enabled.  If you added the UseUnicode, remove it or make it False.

 

Then open up Region and Language, and go into Administrative.  Then in language from non-Unicode programs, select the language you want to use.  With UseUnicode False, Windows will see LabVIEW and a non-Unicode program and enable this feature.

 

Windows 7.jpg

 

 

This will allow you to enter any Unicode text into any push buttons, indicators, and other items.  This was only tested in Windows 7 and so far I have not had any issues.

 

Unicode 2.jpg

 

Unicode 3.jpg

 

 

Doug

Message 1 of 6
(3,892 Views)

Interesting!

 

What happens when you deploy one of your applications on someone else's computer as an executable? Especially if that user hasn't taken any special steps to set program language settings.

0 Kudos
Message 2 of 6
(3,888 Views)

Any computer that runs the exe will need to have Windows set to handle Unicode or it will display garbage characters.  You can edit the vi on a computer that does not have Windows setup for Unicode and everything will remain intact. 

0 Kudos
Message 3 of 6
(3,869 Views)

Hi, Doug,

 

Changing system locale for non-unicode apps requires Windows restart. Usually in development of the multi language applications I using app locale utility from Microsoft (http://www.microsoft.com/en-us/download/details.aspx?id=13209). With this tool you can run LabVIEW (or builded app) under different locales withot changing systel locale in Conrol Panel.

 

But proposed way will not make LabVIEW full compatible with unicode. For example, what shall I do If I need to use both German and Russian locales at the same time?

 

 

Message 4 of 6
(3,868 Views)

I will check out the language app, it looks good.  Thanks

 

0 Kudos
Message 5 of 6
(3,856 Views)

One of our interns recently went through this adapting a program to display Chinese in the user interface.  His solution ended up being surprisingly simple:  Just read the strings from a text file stored using the target encoding.  In our case, there were really only two encodings of interest: Windows code-page 1252 (used on our company's computers located in North America) and UTF-8 (used on our company's computers in China).

 

This scheme could be expanded to choose an internationalization/translation file based on the target language and system encoding.  You could also store all of the translations encoded in UTF-8 and use the (undocumented) UTF-8 to Text function to convert the translated string to the local code page.

 

Mark Moss

Electrical Validation Engineer

GHSP

Message 6 of 6
(3,830 Views)