The following functions serve for mapping characters between character classes (character transliteration). If a mapping for a character is in the character class of the current locale, the functions return a transliterated character. These functions are locale sensitive.
Convert an uppercase character to lowercase
Convert a lowercase character to uppercase
Convert an uppercase wide character to lowercase
Convert a lowercase wide character to uppercase
The following functions provide a generic way to perform character transliteration:
Define character mapping
Wide-character mapping
For more information about related functions for Unicode strings, see Processing UTF-8 Strings.
Example 2-12 Transliteration of a Wide CharacterThe following code fragment shows how to use the towupper() function for transliterating a Unicode wide character to uppercase.
wint_t wc; int ret; setlocale(LC_ALL, "cs_CZ.UTF-8"); /* "\xc5\x99" is UTF-8 for LATIN SMALL LETTER R WITH CARON */ ret = mbtowc(&wc, "\xc5\x99", 2); if (ret == (size_t)-1) { /* Invalid character sequence. */ : } wprintf(L"'%c' is uppercase of '%c'.\n", towupper(wc), wc);
The example will produce the following output:
Ř is uppercase of ř.