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 Traditional Chinese Solaris, 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 specific 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 Codeset

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 following routines are in the regular Chinese C library:

Table B-2




Converts codeset 1 Roman lowercase to uppercase.  


Converts codeset 1 Roman uppercase to lowercase.  

Conversion for Traditional Chinese Character Codes

The following routines 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 B-3




Converts Big5 character to EUC. 


Converts CNS character to EUC. 


Converts EUC character to Big5. 


Converts EUC character to CNS. 

Table B-4




Converts Big5 string to EUC. 


Converts CNS string to EUC. 


Converts EUC string to Big5. 


Converts EUC string to CNS.