~vcs-imports/libiconv/trunk

« back to all changes in this revision

Viewing changes to man/iconv.3

  • Committer: Bruno Haible
  • Date: 2023-05-24 23:43:25 UTC
  • Revision ID: git-v1:bf03f38b06c5320166d0315414b9e3652d4bb4d1
man pages: List a fifth condition when iconv(3) may stop.

Based on the patch to the man-pages project
<https://marc.info/?l=linux-man&m=168496625522371&w=2> =
<https://lore.kernel.org/linux-man/2f9c4dbd-7aa6-fc7a-f126-453603ef695e@gmail.com/T/#m25e33d4defa1118e5c84951790f0319360abf9d4>

* man/iconv.3: List a fifth condition.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
.\"   GNU glibc-2 source code and manual
10
10
.\"   OpenGroup's Single Unix specification http://www.UNIX-systems.org/online.html
11
11
.\"
12
 
.TH ICONV 3  "September 7, 2008" "GNU"
 
12
.TH ICONV 3  "May 24, 2023" "GNU"
13
13
.SH NAME
14
14
iconv \- perform character set conversion
15
15
.SH SYNOPSIS
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:
42
42
.PP
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.
55
55
.PP
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
 
59
descriptor.
 
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
 
69
used as a fallback.
 
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
 
73
sequence.
 
74
.PP
 
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).
58
77
.PP
59
78
A different case is when \fIinbuf\fP is NULL or \fI*inbuf\fP is NULL, but