Page 601 of the C++ Special Edition says...
In <ctype.h> and <cctype>, the standard library provides a set of useful functions for dealing with ASCII and similar character sets.
Would Unicode fall under this "similar character sets" category?
Page 601 of the C++ Special Edition says...
In <ctype.h> and <cctype>, the standard library provides a set of useful functions for dealing with ASCII and similar character sets.
Would Unicode fall under this "similar character sets" category?
Unicode support has been a major pain point of the language. You will have to set a locale for non-ANSI and use the wchar_t variants. The exact meaning of the wchar_t varies with implementation. E.g:
setlocale(LC_CTYPE, "en_ca.UTF-8");
Take a look at the the Unicode Consortium page on locales.
Features from <cctype> are not really usable to support Unicode encodings.
I think that the note on similar character sets is strictly related to family of 8-bit character encodings, for example EBCDIC.
However, notice that it is correct to consider ASCII a subset (or variant) of Unicode. If you use UTF-8 encoding of Unicode, then the first 128 code points are the same as 128 ASCII characters and the first 256 characters are identical to Latin-1. Meaning, all ASCII is considered as valid UTF-8.
That really depends on the implementation. C++ certainly allows it, but doesn't mandate it. You'd need a CHAR_BIT >= 20. In practice, no implementation does so. Unicode is usually supported by wchar_t and the corresponding <cwctype> header.