Developer's Topics
Chapter 2, Complying with standard C

Wide characters

Wide characters

Some of the inconvenience of handling multibyte characters would be eliminated if all characters were of a uniform number of bytes or bits. Since there can be thousands or tens of thousands of ideograms in such a character set, a 16-bit or 32-bit sized integral value should be used to hold all members.


NOTE: The full Chinese alphabet includes more than 65,000 ideograms.

ANSI C includes the typedef name wchar_t as the implementation-defined integral type large enough to hold all members of the extended character set.

For each wide character there is a corresponding multibyte character and vice versa; the wide character that corresponds to a regular single-byte character is required to have the same value as its single-byte value, including the null character. However, there is no guarantee that the value of the macro EOF can be stored in a wchar_t. (Just as EOF might not be representable as a char.)