E.6. Using UnicodeVisual Studio uses Unicode UTF-16 encoding to represent all characters. Figure E.3 uses Visual Basic to display the text "Welcome to Unicode!" in eight different languages: English, French, German, Japanese, Portuguese, Russian, Spanish and Traditional Chinese. Figure E.3. Windows application demonstrating Unicode encoding.
The first welcome message (lines 13-16) contains the hexadecimal codes for the English text. The Code Charts page on the Unicode Consortium Web site contains a document that lists the code values for the Basic Latin block (or category), which includes the English alphabet. The hexadecimal codes in lines 13-14 equate to "Welcome." When using Unicode characters in Visual Basic, the format &Hyyyy is used, where yyyy represents the hexadecimal Unicode encoding. For example, the letter "W" (in "Welcome") is denoted by &H57. [Note: The actual code for the letter "W" is &H0057, but Visual Studio removes the two zeros.] Line 15 contains the hexadecimal for the space character (&H20). The hexadecimal value for the word "to" is on line 15 and the word "Unicode" is on line 14. "Unicode" is not encoded because it is a registered trademark and has no equivalent translation in most languages. Line 16 also contains the &H21 notation for the exclamation mark (!). The remaining welcome messages (lines 18-61) contain the hexadecimal codes for the other seven languages. The code values used for the French, German, Portuguese and Spanish text are located in the Basic Latin block, the code values used for the Traditional Chinese text are located in the CJK Unified Ideographs block, the code values used for the Russian text are located in the Cyrillic block and the code values used for the Japanese text are located in the Hiragana block. [Note: To render the Asian characters in a Windows application, you would need to install the proper language files on your computer. To do this, open the Regional Options dialog from the Control Panel (Start > Settings > Control Panel). At the bottom of the General tab is a list of languages. Check the Japanese and the Traditional Chinese checkboxes and press Apply. Follow the directions of the install wizard to install the languages. For additional assistance, visit www.unicode.org/help/display_problems.html.] |