Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
iconv(3)
Edit
PageHistory
Diff
Info
LikePages
ICONV !!!ICONV NAME SYNOPSIS DESCRIPTION RETURN VALUE ERRORS CONFORMING TO SEE ALSO ---- !!NAME iconv - perform character set conversion !!SYNOPSIS __#include __ ''cd''__, char* *__ ''inbuf''__, size_t *__ ''inbytesleft''__, char* *__ ''outbuf''__, size_t *__ ''outbytesleft''__); __ !!DESCRIPTION The argument ''cd'' must be a conversion descriptor created using the function __iconv_open__. The main case is when ''inbuf'' is not NULL and ''*inbuf'' is not NULL. In this case, the __iconv__ function converts the multibyte sequence starting at ''*inbuf'' to a multibyte sequence starting at ''*outbuf''. At most ''*inbytesleft'' bytes, starting at ''*inbuf'', will be read. At most ''*outbytesleft'' bytes, starting at ''*outbuf'', will be written. The __iconv__ function converts one multibyte character at a time, and for each character conversion it increments ''*inbuf'' and decrements ''*inbytesleft'' by the number of converted input bytes, it increments ''*outbuf'' and decrements ''*outbytesleft'' by the number of converted output bytes, and it updates the conversion state contained in ''cd''. The conversion can stop for four reasons: 1. An invalid multibyte sequence is encountered in the input. In this case it sets __errno__ to __EILSEQ__ and returns (size_t)(-1). ''*inbuf'' is left pointing to the beginning of the invalid multibyte sequence. 2. The input byte sequence has been entirely converted, i.e. ''*inbytesleft'' has gone down to 0. In this case __iconv__ returns the number of non-reversible conversions performed during this call. 3. An incomplete multibyte sequence is encountered in the input, and the input byte sequence terminates after it. In this case it sets __errno__ to __EINVAL__ and returns (size_t)(-1). ''*inbuf'' is left pointing to the beginning of the incomplete multibyte sequence. 4. The output buffer has no more room for the next converted character. In this case it sets __errno__ to __E2BIG__ and returns (size_t)(-1). A different case is when ''inbuf'' is NULL or ''*inbuf'' is NULL, but ''outbuf'' is not NULL and ''*outbuf'' is not NULL. In this case, the __iconv__ function attempts to set ''cd'''s conversion state to the initial state and store a corresponding shift sequence at ''*outbuf''. At most ''*outbytesleft'' bytes, starting at ''*outbuf'', will be written. If the output buffer has no more room for this reset sequence, it sets __errno__ to __E2BIG__ and returns (size_t)(-1). Otherwise it increments ''*outbuf'' and decrements ''*outbytesleft'' by the number of bytes written. A third case is when ''inbuf'' is NULL or ''*inbuf'' is NULL, and ''outbuf'' is NULL or ''*outbuf'' is NULL. In this case, the __iconv__ function sets ''cd'''s conversion state to the initial state. !!RETURN VALUE The __iconv__ function returns the number of characters converted in a non-reversible way during this call; reversible conversions are not counted. In case of error, it sets __errno__ and returns (iconv_t)(-1). !!ERRORS The following errors can occur, among others: __E2BIG__ There is not sufficient room at ''*outbuf''. __EILSEQ__ An invalid multibyte sequence has been encountered in the input. __EINVAL__ An incomplete multibyte sequence has been encountered in the input. !!CONFORMING TO UNIX98 !!SEE ALSO iconv_open(3), __iconv_close__(3) ----
9 pages link to
iconv(3)
:
muttrc(5)
Man3i
iconv_close(3)
iconv_open(3)
mbsnrtowcs(3)
mbsrtowcs(3)
wcsnrtombs(3)
wcsrtombs(3)
UnicodeNotes
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.