Annotation of embedaddon/libiconv/man/iconv.3.html, revision 1.1.1.3

1.1.1.3 ! misho       1: <!-- Creator     : groff version 1.22.3 -->
1.1.1.2   misho       2: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                      3: "http://www.w3.org/TR/html4/loose.dtd">
1.1       misho       4: <html>
                      5: <head>
                      6: <meta name="generator" content="groff -Thtml, see www.gnu.org">
1.1.1.2   misho       7: <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
1.1       misho       8: <meta name="Content-Style" content="text/css">
1.1.1.2   misho       9: <style type="text/css">
                     10:        p       { margin-top: 0; margin-bottom: 0; vertical-align: top }
                     11:        pre     { margin-top: 0; margin-bottom: 0; vertical-align: top }
                     12:        table   { margin-top: 0; margin-bottom: 0; vertical-align: top }
                     13:        h1      { text-align: center }
                     14: </style>
1.1       misho      15: <title>ICONV</title>
1.1.1.2   misho      16: 
1.1       misho      17: </head>
                     18: <body>
                     19: 
1.1.1.2   misho      20: <h1 align="center">ICONV</h1>
                     21: 
1.1       misho      22: <a href="#NAME">NAME</a><br>
                     23: <a href="#SYNOPSIS">SYNOPSIS</a><br>
                     24: <a href="#DESCRIPTION">DESCRIPTION</a><br>
                     25: <a href="#RETURN VALUE">RETURN VALUE</a><br>
                     26: <a href="#ERRORS">ERRORS</a><br>
                     27: <a href="#CONFORMING TO">CONFORMING TO</a><br>
                     28: <a href="#SEE ALSO">SEE ALSO</a><br>
                     29: 
                     30: <hr>
1.1.1.2   misho      31: 
                     32: 
                     33: <h2>NAME
1.1       misho      34: <a name="NAME"></a>
1.1.1.2   misho      35: </h2>
                     36: 
                     37: 
                     38: <p style="margin-left:11%; margin-top: 1em">iconv &minus;
                     39: perform character set conversion</p>
                     40: 
                     41: <h2>SYNOPSIS
1.1       misho      42: <a name="SYNOPSIS"></a>
1.1.1.2   misho      43: </h2>
                     44: 
                     45: 
                     46: <p style="margin-left:11%; margin-top: 1em"><b>#include
                     47: &lt;iconv.h&gt;</b></p>
                     48: 
                     49: <p style="margin-left:11%; margin-top: 1em"><b>size_t iconv
                     50: (iconv_t</b> <i>cd</i><b>, <br>
                     51: const char* *</b> <i>inbuf</i><b>, size_t *</b>
                     52: <i>inbytesleft</i><b>, <br>
                     53: char* *</b> <i>outbuf</i><b>, size_t *</b>
                     54: <i>outbytesleft</i><b>);</b></p>
                     55: 
                     56: <h2>DESCRIPTION
1.1       misho      57: <a name="DESCRIPTION"></a>
1.1.1.2   misho      58: </h2>
1.1       misho      59: 
1.1.1.2   misho      60: 
                     61: <p style="margin-left:11%; margin-top: 1em">The argument
                     62: <i>cd</i> must be a conversion descriptor created using the
                     63: function <b>iconv_open</b>.</p>
                     64: 
                     65: <p style="margin-left:11%; margin-top: 1em">The main case
                     66: is when <i>inbuf</i> is not NULL and <i>*inbuf</i> is not
                     67: NULL. In this case, the <b>iconv</b> function converts the
                     68: multibyte sequence starting at <i>*inbuf</i> to a multibyte
                     69: sequence starting at <i>*outbuf</i>. At most
                     70: <i>*inbytesleft</i> bytes, starting at <i>*inbuf</i>, will
                     71: be read. At most <i>*outbytesleft</i> bytes, starting at
                     72: <i>*outbuf</i>, will be written.</p>
                     73: 
                     74: <p style="margin-left:11%; margin-top: 1em">The
                     75: <b>iconv</b> function converts one multibyte character at a
                     76: time, and for each character conversion it increments
                     77: <i>*inbuf</i> and decrements <i>*inbytesleft</i> by the
                     78: number of converted input bytes, it increments
1.1       misho      79: <i>*outbuf</i> and decrements <i>*outbytesleft</i> by the
                     80: number of converted output bytes, and it updates the
                     81: conversion state contained in <i>cd</i>. If the character
                     82: encoding of the input is stateful, the <b>iconv</b> function
                     83: can also convert a sequence of input bytes to an update of
                     84: the conversion state without producing any output bytes;
                     85: such input is called a <i>shift sequence</i>. The conversion
                     86: can stop for four reasons:</p>
1.1.1.2   misho      87: 
                     88: <p style="margin-left:11%; margin-top: 1em">1. An invalid
                     89: multibyte sequence is encountered in the input. In this case
                     90: it sets <b>errno</b> to <b>EILSEQ</b> and returns
                     91: (size_t)(&minus;1). <i>*inbuf</i> is left pointing to the
                     92: beginning of the invalid multibyte sequence.</p>
                     93: 
                     94: <p style="margin-left:11%; margin-top: 1em">2. The input
                     95: byte sequence has been entirely converted, i.e.
                     96: <i>*inbytesleft</i> has gone down to 0. In this case
1.1       misho      97: <b>iconv</b> returns the number of non-reversible
                     98: conversions performed during this call.</p>
1.1.1.2   misho      99: 
                    100: <p style="margin-left:11%; margin-top: 1em">3. An
                    101: incomplete multibyte sequence is encountered in the input,
                    102: and the input byte sequence terminates after it. In this
                    103: case it sets <b>errno</b> to <b>EINVAL</b> and returns
1.1       misho     104: (size_t)(&minus;1). <i>*inbuf</i> is left pointing to the
                    105: beginning of the incomplete multibyte sequence.</p>
1.1.1.2   misho     106: 
                    107: <p style="margin-left:11%; margin-top: 1em">4. The output
                    108: buffer has no more room for the next converted character. In
                    109: this case it sets <b>errno</b> to <b>E2BIG</b> and returns
1.1       misho     110: (size_t)(&minus;1).</p>
1.1.1.2   misho     111: 
                    112: <p style="margin-left:11%; margin-top: 1em">A different
                    113: case is when <i>inbuf</i> is NULL or <i>*inbuf</i> is NULL,
                    114: but <i>outbuf</i> is not NULL and <i>*outbuf</i> is not
                    115: NULL. In this case, the <b>iconv</b> function attempts to
                    116: set <i>cd</i>&rsquo;s conversion state to the initial state
                    117: and store a corresponding shift sequence at <i>*outbuf</i>.
                    118: At most <i>*outbytesleft</i> bytes, starting at
                    119: <i>*outbuf</i>, will be written. If the output buffer has no
                    120: more room for this reset sequence, it sets <b>errno</b> to
                    121: <b>E2BIG</b> and returns (size_t)(&minus;1). Otherwise it
                    122: increments <i>*outbuf</i> and decrements
                    123: <i>*outbytesleft</i> by the number of bytes written.</p>
                    124: 
                    125: <p style="margin-left:11%; margin-top: 1em">A third case is
                    126: when <i>inbuf</i> is NULL or <i>*inbuf</i> is NULL, and
                    127: <i>outbuf</i> is NULL or <i>*outbuf</i> is NULL. In this
                    128: case, the <b>iconv</b> function sets <i>cd</i>&rsquo;s
                    129: conversion state to the initial state.</p>
                    130: 
                    131: <h2>RETURN VALUE
                    132: <a name="RETURN VALUE"></a>
                    133: </h2>
                    134: 
                    135: 
                    136: <p style="margin-left:11%; margin-top: 1em">The
                    137: <b>iconv</b> function returns the number of characters
                    138: converted in a non-reversible way during this call;
                    139: reversible conversions are not counted. In case of error, it
                    140: sets <b>errno</b> and returns (size_t)(&minus;1).</p>
                    141: 
                    142: <h2>ERRORS
1.1       misho     143: <a name="ERRORS"></a>
1.1.1.2   misho     144: </h2>
                    145: 
                    146: 
                    147: <p style="margin-left:11%; margin-top: 1em">The following
                    148: errors can occur, among others:</p>
                    149: 
                    150: <table width="100%" border="0" rules="none" frame="void"
                    151:        cellspacing="0" cellpadding="0">
1.1       misho     152: <tr valign="top" align="left">
                    153: <td width="11%"></td>
1.1.1.2   misho     154: <td width="9%">
                    155: 
1.1       misho     156: 
1.1.1.2   misho     157: <p><b>E2BIG</b></p></td>
                    158: <td width="2%"></td>
                    159: <td width="78%">
1.1       misho     160: 
1.1.1.2   misho     161: 
                    162: <p>There is not sufficient room at <i>*outbuf</i>.</p></td></tr>
1.1       misho     163: <tr valign="top" align="left">
                    164: <td width="11%"></td>
1.1.1.2   misho     165: <td width="9%">
                    166: 
                    167: 
                    168: <p><b>EILSEQ</b></p></td>
                    169: <td width="2%"></td>
                    170: <td width="78%">
1.1       misho     171: 
                    172: 
                    173: <p>An invalid multibyte sequence has been encountered in
1.1.1.2   misho     174: the input.</p></td></tr>
1.1       misho     175: <tr valign="top" align="left">
                    176: <td width="11%"></td>
1.1.1.2   misho     177: <td width="9%">
                    178: 
                    179: 
                    180: <p><b>EINVAL</b></p></td>
                    181: <td width="2%"></td>
                    182: <td width="78%">
1.1       misho     183: 
                    184: 
                    185: <p>An incomplete multibyte sequence has been encountered in
1.1.1.2   misho     186: the input.</p></td></tr>
1.1       misho     187: </table>
1.1.1.2   misho     188: 
                    189: <h2>CONFORMING TO
1.1       misho     190: <a name="CONFORMING TO"></a>
1.1.1.2   misho     191: </h2>
                    192: 
                    193: 
                    194: <p style="margin-left:11%; margin-top: 1em">POSIX:2001</p>
                    195: 
                    196: <h2>SEE ALSO
1.1       misho     197: <a name="SEE ALSO"></a>
1.1.1.2   misho     198: </h2>
                    199: 
                    200: 
                    201: 
                    202: <p style="margin-left:11%; margin-top: 1em"><b>iconv_open</b>(3),
                    203: <b>iconvctl</b>(3) <b>iconv_close</b>(3)</p>
1.1       misho     204: <hr>
                    205: </body>
                    206: </html>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>