24.05.2014 Views

AIX Version 4.3 Differences Guide

AIX Version 4.3 Differences Guide

AIX Version 4.3 Differences Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

wctomb()<br />

wcswidth()<br />

Table 48. Internal Locale Methods Called for Each Locale<br />

Convert wide character to multi-byte character. All of the provided<br />

wctomb() methods convert a Unicode value to the appropriate<br />

multi-byte string. There are three different methods provided to<br />

optimize performance of this operation based on the nature of the<br />

multi-byte codeset:<br />

• __wctomb_iso1() - Since ISO8859-1 is a proper subset of Unicode,<br />

its data can be converted from Unicode by simply casting its 16-bit<br />

value to an 8-bit value. This is the fastest method for converting<br />

Unicode to ISO8859-1.<br />

• __wctomb_utf() - UTF-8-based data can be converted from<br />

Unicode by using a simple bit-shifting algorithm. This method<br />

should be used for all UTF-8-based locales since it is faster than<br />

the __wctomb_std() method listed below.<br />

• __wctomb_std() - For all other codesets, the __wctomb_std()<br />

method converts the multi-byte data from Unicode using the iconv()<br />

interface. The conversion descriptor is defined as a static pointer so<br />

that multiple calls to __wctomb_std() will not occur. Because this<br />

locale method is dependent on libiconv, it has been placed into a<br />

common locale method object in /usr/lib/nls/loc/methods/stdmeth.o<br />

instead of the libc library to avoid creating an unnecessary<br />

dependency between libc and libiconv.<br />

Determine the display width of a wide character string. There is one<br />

standard locale method, __wcswidth_std(), that loops through the<br />

wide character string calling wcwidth() to determine the display<br />

width of each character.<br />

wcwidth() Determine the display width of a wide character. Since all wide<br />

characters can be assumed to have the Unicode encoding, each<br />

character's display width can be determined with a single locale<br />

method.<br />

• __wcwidth_std() - Determine the display width of a character based<br />

on its Unicode value. Most characters that can be displayed have a<br />

display width of 1; CJK ideographs and Hangul syllables will have a<br />

display width of 2, and combining characters have a width of 0. The<br />

assumption that the wide character encoding is Unicode allows for<br />

a single wcwidth() method that is appropriate for all locales.<br />

Localedef Command Impacts<br />

The localedef command has a global method table that is defined<br />

internally to the command and is used if the localedef command<br />

user does not explicitly state the methods desired using the -m flag.<br />

These tables will need to be modified and expanded to reflect the<br />

newly-available methods.<br />

Locale method Unicode locales ISO8859-1-based<br />

locales<br />

Single byte<br />

non-ISO1-based<br />

locales<br />

Multi-byte locales<br />

mblen() __mblen_utf() __mblen_sb() __mblen_sb() __mblen_std()<br />

mbstopcs() __mbstopcs_std() __mbstopcs_std() __mbstopcs_std() __mbstopcs_std()<br />

mbstowcs() __mbstowcs_std() __mbstowcs_std() __mbstowcs_std() __mbstowcs_std()<br />

National Language Support 247

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!