ANSI/ISO C provides five library functions that manage multibyte characters and wide characters:
Table E-2 Multibyte Character Conversion Functionsmblen() | length of next multibyte character |
mbtowc() | convert multibyte character to wide character |
wctomb() | convert wide character to multibyte character |
mbstowcs() | convert multibyte character string to wide character string |
wcstombs() | convert wide character string to multibyte character string |
The behavior of all of these functions depends on the current locale. (See "The setlocale() Function ".)
It is expected that vendors providing compilation systems targeted to this market supply many more string-like functions to simplify the handling of wide character strings. However, for most application programs, there is no need to convert any multibyte characters to or from wide characters. Programs such as diff, for example, read in and write out multibyte characters, needing only to check for an exact byte-for-byte match. More complicated programs, such as grep, that use regular expression pattern matching, may need to understand multibyte characters, but only the common set of functions that manages the regular expression needs this knowledge. The program grep itself requires no other special multibyte character handling.