4.4BSD/usr/share/man/cat3/multibyte.0

Compare this file to the similar file:
Show the results in this format:

MULTIBYTE(3)                BSD Programmer's Manual               MULTIBYTE(3)

NNAAMMEE
     mmbblleenn, mmbbssttoowwccss, mmbbttoowwcc, wwccssttoommbbss, wwccttoommbb - multibyte character support
     for C

SSYYNNOOPPSSIISS
     ##iinncclluuddee <<ssttddlliibb..hh>>

     _i_n_t
     mmbblleenn(_c_o_n_s_t _c_h_a_r _*_m_b_c_h_a_r, _i_n_t _n_b_y_t_e_s);

     _s_i_z_e___t
     mmbbssttoowwccss(_w_c_h_a_r___t _*_w_c_s_t_r_i_n_g, _c_o_n_s_t _c_h_a_r _*_m_b_s_t_r_i_n_g, _s_i_z_e___t _n_w_c_h_a_r_s);

     _i_n_t
     mmbbttoowwcc(_w_c_h_a_r___t _*_w_c_h_a_r_p, _c_o_n_s_t _c_h_a_r _*_m_b_c_h_a_r, _s_i_z_e___t _n_b_y_t_e_s);

     _s_i_z_e___t
     wwccssttoommbbss(_c_h_a_r _*_m_b_s_t_r_i_n_g, _c_o_n_s_t _w_c_h_a_r___t _*_w_c_s_t_r_i_n_g, _s_i_z_e___t _n_b_y_t_e_s);

     _i_n_t
     wwccttoommbb(_c_h_a_r _*_m_b_c_h_a_r, _w_c_h_a_r___t _w_c_h_a_r);

DDEESSCCRRIIPPTTIIOONN
     The basic elements of some written natural languages such as Chinese can-
     not be represented uniquely with single C _c_h_a_rs. The C standard supports
     two different ways of dealing with extended natural language encodings,
     _w_i_d_e characters and _m_u_l_t_i_b_y_t_e characters.  Wide characters are an inter-
     nal representation which allows each basic element to map to a single ob-
     ject of type _w_c_h_a_r___t. Multibyte characters are used for input and output
     and code each basic element as a sequence of C _c_h_a_rs. Individual basic
     elements may map into one or more (up to MB_CHAR_MAX) bytes in a multi-
     byte character.

     The current locale (setlocale(3))  governs the interpretation of wide and
     multibyte characters.  The locale category LC_CTYPE specifically controls
     this interpretation.  The _w_c_h_a_r___t type is wide enough to hold the largest
     value in the wide character representations for all locales.

     Multibyte strings may contain `shift' indicators to switch to and from
     particular modes within the given representation.  If explicit bytes are
     used to signal shifting, these are not recognized as separate characters
     but are lumped with a neighboring character.  There is always a distin-
     guished `initial' shift state.  The mmbbssttoowwccss() and wwccssttoommbbss() functions
     assume that multibyte strings are interpreted starting from the initial
     shift state.  The mmbblleenn(), mmbbttoowwcc() and wwccttoommbb() functions maintain stat-
     ic shift state internally.  A call with a null _m_b_c_h_a_r pointer returns
     nonzero if the current locale requires shift states, zero otherwise; if
     shift states are required, the shift state is reset to the initial state.
     The internal shift states are undefined after a call to sseettllooccaallee() with
     the LC_CTYPE or LC_ALL categories.

     For convenience in processing, the wide character with value 0 (the null
     wide character) is recognized as the wide character string terminator,
     and the character with value 0 (the null byte) is recognized as the
     multibyte character string terminator.  Null bytes are not permitted
     within multibyte characters.

     The mmbblleenn() function computes the length in bytes of a multibyte charac-
     ter _m_b_c_h_a_r. Up to _n_b_y_t_e_s bytes are examined.

     The mmbbttoowwcc() function converts a multibyte character _m_b_c_h_a_r into a wide
     character and stores the result in the object pointed to by _w_c_h_a_r_p_. Up to
     _n_b_y_t_e_s bytes are examined.

     The wwccttoommbb() function converts a wide character _w_c_h_a_r into a multibyte
     character and stores the result in _m_b_c_h_a_r. The object pointed to by
     _m_b_c_h_a_r must be large enough to accommodate the multibyte character.

     The mmbbssttoowwccss() function converts a multibyte character string _m_b_s_t_r_i_n_g
     into a wide character string _w_c_s_t_r_i_n_g. No more than _n_w_c_h_a_r_s wide charac-
     ters are stored.  A terminating null wide character is appended if there
     is room.

     The wwccssttoommbbss() function converts a wide character string _w_c_s_t_r_i_n_g into a
     multibyte character string _m_b_s_t_r_i_n_g. Up to _n_b_y_t_e_s bytes are stored in
     _m_b_s_t_r_i_n_g. Partial multibyte characters at the end of the string are not
     stored.  The multibyte character string is null terminated if there is
     room.

RREETTUURRNN VVAALLUUEESS
     If multibyte characters are not supported in the current locale, all of
     these functions will return -1 if characters can be processed, otherwise
     0.

     If _m_b_c_h_a_r is NULL, the mmbblleenn(), mmbbttoowwcc() and wwccttoommbb() functions return
     nonzero if shift states are supported, zero otherwise.  If _m_b_c_h_a_r is
     valid, then these functions return the number of bytes processed in
     _m_b_c_h_a_r, or -1 if no multibyte character could be recognized or converted.

     The mmbbssttoowwccss() function returns the number of wide characters converted,
     not counting any terminating null wide character.  The wwccssttoommbbss() func-
     tion returns the number of bytes converted, not counting any terminating
     null byte.  If any invalid multibyte characters are encountered, both
     functions return -1.

SSEEEE AALLSSOO
     euc(4),  mbrune(3),  rune(3),  setlocale(3),  utf2(4)

SSTTAANNDDAARRDDSS
     The mmbblleenn(), mmbbssttoowwccss(), mmbbttoowwcc(), wwccssttoommbbss() and wwccttoommbb() functions con-
     form to ANSI C X3.159-1989 (``ANSI C '').

BBUUGGSS
     The current implementation does not support shift states.

4.4BSD                           June 4, 1993                                2