93.15 Special Topics

Suppose you decide to used mixed character types, and find that you have an ANSI string and need a Unicode string?

The Windows 32-bit API provides two handy functions: WideCharToMultiByte and MultiByteToWideChar which can handle the translation for you. ANSI C also defines a set of conversion functions wctomb and mbtowc, but they can only convert to and from the character set supported by the C run time.

How does this interact with DBCS? DBCS is the “generalized” case of an 8-bit character set, since its smallest unit is a byte. It is, so to speak, the ANSI character set for the Japanese version. The Windows 32-bit API for the Japanese version will accept DBCS strings for the ANSI versions of the function. However, unlike Unicode, supporting DBCS character handling requires detailed changes in the character processing algorithms throughout an application program.

How do you get Unicode command line arguments? The function GetCommandLine can be called as Unicode function to return command line arguments in Unicode.