The Solaris 9 environment offers two sets of APIs:
Multibyte (file codes)
Wide characters (process code)
Wide-character codes are fixed-width units of logical entities. Therefore, you do not have to keep track of maintaining proper character boundaries when you are using multibyte characters.
When a program takes input from a file, you can convert your file's multibyte data into wide-character process code directly with input functions like fscanf(3S) and fwscanf(3S) or by using conversion functions like mbtowc(3C) and mbsrtowcs(3C) after the input. To convert output data from wide-character format to multibyte character format, use output functions like fwprintf(3S) and fprintf(3S), or apply conversion functions like wctomb(3C) and wcsrtombs(3C) before the output.
The tables in the remainder of this chapter describe the internationalization APIs included in the Solaris 9 product.
The following table describes the messaging function APIs in libc.
Table 2–1 Messaging Functions in libc
Library Routine |
Description |
---|---|
catclose() |
Close a message catalog |
catgets() |
Read a program message |
catopen() |
Open a message catalog |
dgettext() |
Get a message from a message catalog with domain specified |
dcgettext() |
Get a message from a message catalog with domain and category specified |
textdomain() |
Set and query the current domain |
bindtextdomain() |
Bind the path for a message domain |
gettext() |
Retrieve text string from message database |
The following table describes the code conversion function APIs in libc.
Table 2–2 Code Conversion in libc
Library Routine |
Description |
---|---|
iconv() |
Convert codes |
iconv_close() |
Deallocate the conversion descriptor |
iconv_open() |
Allocate the conversion descriptor |
Thise following table describes the regular expression APIs in libc.
Table 2–3 Regular Expressions in libc
Library Routine |
Description |
---|---|
regcomp() |
Compile the regular expression |
regexec() |
Execute regular expression matching |
regerror() |
Provide a mapping from error codes to error messages |
regfree() |
Free memory allocated by regcomp() |
fnmatch() |
Match file name or path name |
The following table describes the wide character function APIs in libc.
Table 2–4 Wide Character Class in libc
Library Routine |
Description |
---|---|
wctype() |
Define character class |
wctrans() |
Define character mapping |
The following table lists the modify and query locale in libc.
Table 2–5 Modify and Query Locale in libc
Library Routine |
Description |
---|---|
setlocale() |
Modify and query a program's locale |
The following table lists the query locale data in libc.
Table 2–6 Query Locale Data in libc
Library Routine |
Description |
---|---|
nl_langinfo() |
Get language and cultural information of current locale |
localeconv() |
Get monetary and numeric formatting information of current locale |
The following table describes the character classification function APIs in libc.
Table 2–7 Character Classification and Transliteration in libc
Library Routine |
Description |
---|---|
isalpha() |
Is character alphabetic? |
isupper() |
Is character uppercase? |
islower() |
Is character lowercase? |
isdigit() |
Is character a digit? |
isxdigit() |
Is character a hex digit? |
isalnum() |
Is character alphabetic or digital? |
isspace() |
Is character a space? |
ispunct() |
Is character a punctuation mark? |
isprint() |
Is character printable? |
iscntrl() |
Is character a control character? |
isascii() |
Is character an ASCII character? |
isgraph() |
Is character a visible character? |
isphonogram() |
Is wide character a phonogram? |
isideogram() |
Is wide character an ideogram? |
isenglish() |
Is wide character in English alphabet from a supplementary codeset? |
isnumber() |
Is wide character a digit from a supplementary codeset? |
isspecial() |
Is special wide character from a supplementary codeset? |
iswalpha() |
Is wide character alphabetic? |
iswupper() |
Is wide character uppercase? |
iswlower() |
Is wide character lowercase? |
iswdigit() |
Is wide-character a digit? |
iswxdigit() |
Is wide character a hex digit? |
iswalnum() |
Is wide character an alphabetic character or digit? |
iswspace() |
Is wide character a white space? |
iswpunct() |
Is wide character a punctuation mark? |
iswprint() |
Is wide character a printable character? |
iswgraph() |
Is wide character a visible character? |
iswcntrl() |
Is wide character a control character? |
iswascii() |
Is wide character an ASCII character? |
toupper() |
Convert a lowercase character to uppercase. |
tolower() |
Convert an uppercase character to lowercase. |
towupper() |
Convert a lowercase wide character to uppercase. |
towlower() |
Convert an uppercase wide character to lowercase. |
towctrans() |
Wide character mapping. |
The following table describes the character collation function APIs in libc.
Table 2–8 Character Collation in libc
Library Routine |
Description |
---|---|
strcoll() |
Collate character strings |
strxfrm() |
Transform character strings for comparison |
wcscoll() |
Collate wide-character strings |
wcsxfrm() |
Transform wide-character strings for comparison |
The following table describes the monetary handling function APIs in libc.
Table 2–9 Monetary Formatting in libc
Library Routine |
Description |
---|---|
localeconv() |
Get monetary formatting information for the current locale |
strfmon() |
Convert monetary value to string representation |
The following table describes the date and time formatting in libc.
Table 2–10 Date and Time Formatting in libc
Library Routine |
Description |
---|---|
getdate() |
Convert user format date and time. |
strftime() |
Convert date and time to string representation. The %u conversion function conforms to the X/Open CAE Specification, System Interfaces and Headers, Issue 4, Version 2. This function represents a weekday as a decimal number [1,7], with 1 now representing Monday. |
strptime() |
Date and time conversion. |
The following table describes the multibyte handling function APIs in libc.
Table 2–11 Multibyte Handling in libc
Library Routine |
Description |
---|---|
btowc() |
Single-byte to wide-character conversion |
mbrlen() |
Get number of bytes in character (restartable) |
mbsinit() |
Determine conversion object status |
mbrtowc() |
Convert a character to a wide-character code (restartable) |
mbsrtowcs() |
Convert a character string to a wide-character string (restartable) |
mblen() |
Get number of bytes in a character |
mbtowc() |
Convert a character to a wide-character code |
mbstowcs() |
Convert a character string to a wide-character string |
The following table describes the wide character and string handling in libc.
Table 2–12 Wide Character and String Handling in libc
Library Routine |
Description |
---|---|
wcsncat() |
Concatenate wide-character strings to length n |
wsdup() |
Duplicate wide-character string |
wcscmp() |
Compare wide-character strings |
wcsncmp() |
Compare wide-character strings to length n |
wcscpy() |
Copy wide-character strings |
wcsncpy() |
Copy wide-character strings to length n |
wcschr() |
Find character in wide-character string |
wcsrchr() |
Find character in wide-character string from right |
wcslen() | Get length of wide-character string |
wscol() |
Return display width of wide-character string |
wcsspn() |
Return span of one wide-character string in another |
wcscspn() |
Return span of one wide-character string not in another |
wcspbrk() |
Return pointer to one wide-character string in another |
wcstok() |
Move token through wide-character string |
wscwcs() |
Find string in wide-character string |
wcstombs() |
Convert wide-character string to multibyte string |
wctomb() |
Convert wide-character to multibyte character |
wcwidth() |
Determine number of column positions of a wide character |
wcswidth() |
Determine number of column positions of a wide-character string |
wctob() |
Wide character to single byte conversion |
wcrtomb() |
Convert a wide-character code to a character (restartable) |
wcstol() |
Convert wide-character string to long integer |
wcstoul() |
Convert wide-character string to unsigned long integer |
wcstod() |
Convert wide-character string to double precision |
wcsrtombs() |
Convert a wide-character string to a character string (restartable) |
wcscat() |
Concatenate wide-character strings |
The following table describes the formatted wide-character input and output in libc.
Table 2–13 Formatted Wide-character Input and Output in libc
Library Routine |
Description |
---|---|
wsprintf() |
Generate wide-character string according to format |
wsscanf() |
Formatted input conversion |
fwprintf() |
Print formatted wide-character output |
fwscanf() |
Convert formatted wide-character input |
wprintf() |
Print formatted wide-character output |
wscanf() |
Convert formatted wide-character input |
swprintf() |
Print formatted wide-character output |
swscanf() |
Convert formatted wide-character input |
vfwprintf() |
Wide-character formatted output of a stdarg argument list |
vswprintf() |
Wide-character formatted output of a stdarg argument list |
This table describes the wide strings function APIs in libc.
Table 2–14 Wide Stringslibc
Library Routine |
Description |
---|---|
wscasecmp() |
Compare wide-character strings, ignore case differences |
wsncasecmp() |
Process code-string operations |
wcsstr() |
Find a wide-character substring |
wmemchr() |
Find a wide character in memory |
wmemcmp() |
Compare wide characters in memory |
wmemcpy() |
Copy wide characters in memory |
wmemmove() |
Copy wide characters in memory with overlapping areas |
wmemset() |
Set wide characters in memory |
The following table describes the wide-character input and output in libc.
Table 2–15 Wide-character Input and Output inlibc
Library Routine |
Description |
---|---|
fgetwc() |
Get multibyte character from stream, convert to wide character |
getwchar() |
Get multibyte character from stdin, convert to wide character |
fgetws() |
Get multibyte string from stream, convert to wide character |
getws() |
Get multibyte string from stdin, convert to wide character |
fputwc() |
Convert wide character to multibyte character, puts to stream |
fwide() |
Set stream orientation |
putwchar() |
Convert wide character to multibyte character, puts to stdin |
fputws() |
Convert wide character to multibyte string, puts to stream |
putws() |
Convert wide character to multibyte string, puts to stdin |
ungetwc() |
Push a wide character back into input stream. |