RE: New on list

From: Murray Sargent (
Date: Tue Jan 12 1999 - 18:14:01 EST

The WideCharToMultiByte() is a little more general in that you can choose
which character to substitute for an unsupported character and you can get a
flag that says whether any such substitutions have been performed. For
example, you can use 0 for the unsupported character, which is an invalid
character and can be used to signal that some other representation is needed
(e.g., \uN in RTF or an NCR in HTML). The question mark is a valid
character in all Windows codepages and consequently isn't useful for this
purpose. One problem is that WCTMB has a nasty habit of trying to help you
by giving "best fit" conversions. E.g., an alpha (0x3b1) is converted to an
ASCII a (0x61) when using codepage 1252, so you may have no warning that you
needed to use the \uN control word. Windows 2000 WCTMB supports a nice new
flag WC_NO_BEST_FIT_CHARS which suppresses this feature and lets the \uN be
output automatically via this mechanism.

If the codepage isn't installed, WCTMB returns 0 for the # bytes in the
converted string.

In the Unicode world, your RTF program definitely needs to support the \uN
control word.


> -----Original Message-----
> From: Addison Phillips []
> Sent: Tuesday, January 12, 1999 11:42 AM
> To: Unicode List
> Subject: RE: New on list
> Be careful with :
> >> On Windows, you can just use WideCharToMultiByte and
> MultiByteToWideChar
> to
> map the text between Unicode and the codepage specified in the file. <<
> You still have to have the code page (the .nls file) installed for the
> MultiByte code page in order for the conversion to work. The default
> conversion is to the code page of the display device (typically CP1252 for
> Western European systems), and, if the code page does not support the
> character, a call to the above will physically replace your character with
> the substitution character (? for 1252 systems).
> Thanks,
> ~Addison

This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:20:44 EDT