International Language Environments Guide

Internationalization APIs in libc

Solaris 8 offers two sets of APIs:

Applications process in wide-character codes.

When a program takes input from a file, convert your file's multibyte data into wide character process code with the mbtwoc and mbtowcs APIs. To convert the file output data from wide character format into multibyte format, use the wcstombs and wctomb APIs.

Table 2-3 shows a list of internationalization APIs included in Solaris 8.

Table 2-3 Internationalization APIs in libc

API Type 

Library Routine 

Description 

Messaging functions 

 

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. 

Code conversion 

 

 

iconv()

Convert codes. 

 

iconv_close()

Deallocate the conversion descriptor. 

 

iconv_open()

Allocate the conversion descriptor. 

Regular expression 

 

 

regcomp()

Compile the regular expression. 

 

regexec()

Execute regular expression matching. 

 

regerror()

Provide a mapping from error codes to error message. 

 

regfree()

Free memory allocated by regcomp().

 

Wide character class 

 

 

wctype()

Define character class. 

 

wctrans

Define character mapping. 

 

towctrans

Wide-character mapping. 

 

setlocale()

Modify and query a program's locale. 

 

nl_langinfo()

Get language and cultural information of current locale. 

 

localeconv()

Get monetary and numeric formatting information of current locale. 

Character classification 

 

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. 

Character collation 

 

strcoll()

Collate character strings. 

 

strxfrm()

Transform character strings for comparison. 

 

wcscoll()

Collate wide character strings. 

 

wcsxfrm()

Transform wide character strings for comparison. 

Monetary handling 

 

strfmon()

Convert monetary value to string representation. 

Date and time handling 

 

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. 

Multibyte handling 

 

btowc

Single-byte to wide-character conversion.  

 

mbrlen()

Get number of bytes in character (restartable). 

 

mbsinit()

Determine conversion object status. 

 

mbtowc()

Convert a character to a wide-character code (restartable). 

 

mbstowcs()

Convert a character string to a wide-character string (restartable). 

Wide characters 

 

 

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. 

 

wcswcs()

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). 

 

wcsrtombs

Interpret wide-character string according to format. 

Wide formatting 

  

 

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.

Wide numbers 

 

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. 

Wide strings 

 

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. 

Wide standard I/O 

 

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.