Thursday, December 31, 2009

English Windows Systems with Chinese

This web page [ How to display and edit Chinese on English Windows systems ] is worth reading. It can make an English Windows system to be able to work with English and Chinese.

This web page [ Enter Chinese Characters under Windows XP - March 18, 2002 ] also has some information with some screen captures.

Well the above articles tell you how to ENABLE your OS to let you input Chinese char and to display Chinese char. Once, the proper font is used, the Chinese char is displayed happily. However, what is the more in-depth knowledge inside ?

Actually, Windows XP is using NTFS filesystem. This filesystem uses unicode as filenames. In other words, all filenames characters (no matter Chinese, Japanese, Korean, English, Greek, ... etc) as stored as unicode UTF-16 format as the filename. This is the underlying filesystem filename data structure.

Then, how the win32 applications interact with this UTF-16 unicode filesystem ? Unfortunately, there are 2 sets of APIs. For those unicode-aware applications, it will use the unicode API to directly handle the unicode filename. For those non-unicode aware application, there are troubles.

When the non-unicode application handles a filename of a string of double-byte, how to convert each double-byte to a unicode ? The non-unicode API will use MBCS codec. The MBCS codec together with locale information will convert a double-byte to a particular unicode char. With the same double-byte char, changing the locale will change the unicode char.

What is the default locale your XP is using ? It is already determined in Control Panel -> Regional and Language Options -> Advanced -> Language for non-Unicode programs.

This comes another troublesome situation. For example, if your system is of default locale being Traditional Chinese, you can still make a file with Japanese char using unicode aware program. Then, how the non-unicode aware program handle this filename ? This Japanese unicode char should map to a double-byte of the Japanese locale. But, the default locale is Traditional Chinese, not Japnese. What to do then ? Sometimes they simply cannot handle this file, or will display question mark in the filename.

For the details of the MBCS and the API, please refer to this web page [ All About Python and Unicode ].


No comments:

Duplicate Open Current Folder in a New Window

Sometimes after I opened a folder in Win7, I would like to duplicate open the same folder again in another explorer window. Then, I can ope...