9
9
.\" GNU glibc-2 source code and manual
10
10
.\" OpenGroup's Single Unix specification http://www.UNIX-systems.org/online.html
12
.TH ICONV 3 "September 7, 2008" "GNU"
12
.TH ICONV 3 "May 24, 2023" "GNU"
14
14
iconv \- perform character set conversion
38
38
If the character encoding of the input is stateful, the \fBiconv\fP function
39
39
can also convert a sequence of input bytes to an update of the conversion state
40
40
without producing any output bytes; such input is called a \fIshift sequence\fP.
41
The conversion can stop for four reasons:
41
The conversion can stop for five reasons:
43
43
1. An invalid multibyte sequence is encountered in the input. In this case
44
44
it sets \fBerrno\fP to \fBEILSEQ\fP and returns (size_t)(\-1). \fI*inbuf\fP
53
53
\fBEINVAL\fP and returns (size_t)(\-1). \fI*inbuf\fP is left pointing to the
54
54
beginning of the incomplete multibyte sequence.
56
4. The output buffer has no more room for the next converted character. In
56
4. A multibyte sequence is encountered that is valid but that cannot be
57
translated to the character encoding of the output.
58
This condition depends on the implementation and on the conversion
60
In the GNU C library and GNU libiconv, if \fIcd\fP was created without the
61
suffix \fB//TRANSLIT\fP or \fB//IGNORE\fP, the conversion is strict: lossy
62
conversions produce this condition.
63
If the suffix \fB//TRANSLIT\fP was specified, transliteration can avoid this
64
condition in some cases.
65
In the musl C library, this condition cannot occur because a conversion to
66
\fB\[aq]*\[aq]\fP is used as a fallback.
67
In the FreeBSD, NetBSD, and Solaris implementations of \fBiconv\fP, this
68
condition cannot occur either, because a conversion to \fB\[aq]?\[aq]\fP is
70
When this condition is met, the \fBiconv\fP function sets \fBerrno\fP to
71
\fBEILSEQ\fP and returns (size_t)(\-1).
72
\fI*inbuf\fP is left pointing to the beginning of the unconvertible multibyte
75
5. The output buffer has no more room for the next converted character. In
57
76
this case it sets \fBerrno\fP to \fBE2BIG\fP and returns (size_t)(\-1).
59
78
A different case is when \fIinbuf\fP is NULL or \fI*inbuf\fP is NULL, but