Traditional Chinese Solaris User's Guide

Asian-Specific Utilities

This section describes functions for wide character and string input and output, character classification, and conversion functions for the Korean or Chinese character sets. Asian Solaris software implements a wide character library for handling Korean or Chinese character codes according to industry standards.

Routines that have Korean or Chinese language-specific dependency are in their own language-specific library, which is linked with the corresponding C compiler option. In the Traditional Chinese Solaris software, libhle is linked with -lhle. Refer to the appropriate man page for more information.

Asian Solaris software defines WC as a constant-width, four-byte code. WC uses the ANSI C data type wchar_t, which Solaris software defines in wchar.h as follows:


typedef long wchar_h;

In Solaris software, long is four bytes.

Conversion Utilities

The conversion utilities described in this section are available, but you should use iconv as a standard function.

Asian Solaris software provides facilities for various conversions, for example:

Programs using the general multibyte conversion utilities should include the header files widec.h and wctype.h. Traditional Chinese Solaris routines (such as ishxxx) are declared in zh_TW/xctype.h.

Programs using the general multibyte conversion utilities should include three header files: wctype.h, widec.h, and zh_TW/xctype.h.

As with classification functions described in the previous section, the use of these utilities can be controlled by the setlocale function. Locale-specific routines are contained in a locale-specific library. For Traditional Chinese, that library is libhle. The library can be linked during compilation using the C compiler option -lhle.

Conversion Within a Code Set

The multibyte conversion functions are similar to the one-byte conversion functions toupper() and tolower(). These functions convert wide-characters to other wide characters. For more information on conversion routines, see the man pages for wconv(3) for all locales and hconv(3) for Traditional Chinese.

The routines listed in the following table are in the regular Chinese C library:

Table A–2 Chinese C Library Conversion Routines

Function 

Description 

tohupper()

Converts code set 1 Roman lowercase to uppercase 

tohlower()

Converts code set 1 Roman uppercase to lowercase 

Conversion for Traditional Chinese Character Codes

The routines listed in the following table perform character-based code conversion on the CNS-11643 character set. They convert characters in the set between CNS-11643, EUC, and Big5 formats. To use these routines, the library hle must be linked using the C compiler option -lhle. For more information, see the hconv(3x) man page.

Table A–3 Character-Based Code Conversion Routines

Function 

Description 

cbig5toeuc()

Converts BIG5 character to EUC 

ccnstoeuc()

Converts CNS character to EUC 

ceuctobig5()

Converts EUC character to BIG5 

ceuctocns()

Converts EUC character to CNS 

Table A–4 Character-Based Code Conversion Routines (cont)

Function 

Description 

big5toeuc()

Converts BIG5 string to EUC. 

cnstoeuc()

Converts CNS string to EUC. 

euctobig5()

Converts EUC string to BIG5. 

euctocns()

Converts EUC string to CNS.