Unicode in LabVIEW - How to Use Foreign Language Characters
It’s just copy and paste, right?
Some time ago, I worked on a LabVIEW application that required different language options for the UI. From a Western European perspective, the implementation of e.g. English, Dutch, and German is rather easy. You can directly type it into the text elements, like strings, captions, and labels. Or you can copy it from e.g. Google Translate and paste it into the text elements. They all use the Latin alphabet, and the “only” challenging part may be the translation (and typos).
But in this case, it was required to include languages with completely different writing systems, like Chinese, Japanese and Korean. Copy-pasting of these foreign language characters does not work:
What is going on here?
By default LabVIEW (in Windows OS) uses Multibyte Character Sets (MBCS) for interpreting strings. MBCS generally supports foreign language characters. But the interpretation of MBCS is based on the regional settings of your operating system. In short, if your operating system (OS) uses the regional settings of e.g. the United States or the Netherlands, it most likely cannot properly interpret Chinese, Japanese, and Korean characters in strings.
So, what to do?
One thing you could consider is changing the regional settings of your OS. However, this can be impractical when the LabVIEW application you develop should support several languages with different writing systems. In addition, it can be quite challenging to work in an OS that was set to e.g. Japanese and you cannot read Japanese.
Another thing you could consider is asking a translator to save the requested characters as pictures, such that they could be used in picture rings. Unfortunately, this option is rather limited considering scalability.
So, is there a different approach?
Is it possible to use foreign language characters in LabVIEW without changing the regional settings of your OS or using pictures?
Yes, there is, and it is called Unicode.
Let’s talk about Unicode
Unicode is a character encoding system designed to support the interchange, processing, and displaying of written text in diverse languages. It was first released in 1993 and its core principle is to assign a unique number to every single character.
It is possible to use Unicode in LabVIEW. However, it’s necessary to first tell LabVIEW that it should use Unicode. This means that the entry “UseUnicode=TRUE” needs to be added to the LabVIEW configuration file “LabVIEW.ini”. Do not forget to restart LabVIEW, when it was already opened.
Afterwards, you are ready to manually copy foreign characters from e.g. Google Translate and paste them into LabVIEW. This works for string constants and controls, Boolean texts, captions, and (free) labels.
It’s also possible to programmatically set foreign language characters, e.g. from a string constant to a string indicator.