27.11.2014 Views

INTRO (7) NetBSD Miscellaneous Information Manual INTRO (7 ...

INTRO (7) NetBSD Miscellaneous Information Manual INTRO (7 ...

INTRO (7) NetBSD Miscellaneous Information Manual INTRO (7 ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

NLS (7) <strong>NetBSD</strong> <strong>Miscellaneous</strong> <strong>Information</strong> <strong>Manual</strong> NLS (7)<br />

The implementation also doesn’t support different character sets. The gettext(3) interface has not been<br />

standardized yet, however itisbeing supported by an increasing number of systems. It also provides many<br />

additional tools which make programming and catalog maintenance much easier.<br />

Support for Multi-byte Encodings<br />

Some character sets with multi-byte encodings may be difficult to decode, or may contain state (i.e., adjacent<br />

characters are dependent). ISO C specifies a set of functions using ’wide characters’ which can handle<br />

multi-byte encodings properly. The behaviour of these functions is affected by the LC_CTYPE category of<br />

the current locale.<br />

Awide character is specified in ISO C as being a fixed number of bits wide and is stateless. There are two<br />

types for wide characters: wchar_t and wint_t. wchar_t is a type which can contain one wide character and<br />

operates like ’char’ type does for one character. wint_t can contain one wide character or WEOF (wide<br />

EOF).<br />

There are functions that operate on wchar_t, and substitute for functions operating on ’char’. See<br />

wmemchr(3) and towlower(3) for details. There are some additional functions that operate on wchar_t.<br />

See wctype(3) and wctrans(3) for details.<br />

Wide characters should be used for all I/O processing which may rely on locale-specific strings. The two<br />

primary issues requiring special use of wide characters are:<br />

• All I/O is performed using multibyte characters. Input data is converted into wide characters<br />

immediately after reading and data for output is converted from wide characters to multi-byte<br />

encoding immediately before writing. Conversion is controlled by the mbstowcs(3),<br />

mbsrtowcs(3), wcstombs(3), wcsrtombs(3), mblen(3), mbrlen(3), and mbsinit(3).<br />

• Wide characters are used directly for I/O, using getwchar(3), fgetwc(3), getwc(3),<br />

ungetwc(3), fgetws(3), putwchar(3), fputwc(3), putwc(3), and fputws(3). They are<br />

also used for formatted I/O functions for wide characters such as fwscanf(3), wscanf(3),<br />

swscanf(3), fwprintf(3), wprintf(3), swprintf(3), vfwprintf(3), vwprintf(3),<br />

and vswprintf(3), and wide character identifier of %lc, %C, %ls, %S for conventional formatted<br />

I/O functions.<br />

SEE ALSO<br />

gencat(1), xfd(1), xterm(1), catgets(3), gettext(3), nl_langinfo(3), setlocale(3),<br />

wsfontload(8)<br />

BUGS<br />

This man page is incomplete.<br />

<strong>NetBSD</strong> 3.0 February 21, 2007 6

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

Saved successfully!

Ooh no, something went wrong!