Monday, June 19, 2017

Working with Hebrew


Written by Tal Alon

Using a language that is not English in our programs can get tricky, especially if we use left to right written languages such as Hebrew. However, for most simple applications it is rather easy. This post explains the proper way to show Hebrew text on a user interface, how to work with files that we create using CVI and how to work with files created by a text editor.

CVI encodes and decodes Hebrew characters using ISO 8859-8 which is one way to encode Hebrew using the old 8 bit ASCII design (not Unicode).

Hebrew text within files that were encoded differently will not be readable without a conversion (will not be shown here), so if you want to read Hebrew strings from files you create make sure you first change the encoding to ISO 8859-8. Most advanced text editors allow you to select the encoding, in notepad++ for example you simply go to Encoding --> Character sets --> Hebrew --> ISO 8859-8.


Just make sure to select it before you enter your text, otherwise the decoding will be different and will turn to gibberish when you switch to ISO 8859-8.

In CVI you should use the GUI edit screen to manually change the 'Character set' of each control to be 'Hebrew' and select a 'Font' that includes Hebrew characters such as Arial or David. This should also be done for the label of a control if you wish it to display Hebrew.



This will allow you to display, Get and Set Hebrew strings easily.

You can easily write the string you get from such controls into a file, and set into them string read from files. File writing and reading methods are the same as with English text, you can read about it here.

No comments:

Post a Comment