]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/iconv_open.3
s/exec()/execve(2)/ in various places.
[thirdparty/man-pages.git] / man3 / iconv_open.3
CommitLineData
fea681da
MK
1.\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
2.\"
3.\" This is free documentation; you can redistribute it and/or
4.\" modify it under the terms of the GNU General Public License as
5.\" published by the Free Software Foundation; either version 2 of
6.\" the License, or (at your option) any later version.
7.\"
8.\" References consulted:
9.\" GNU glibc-2 source code and manual
269e8424
MK
10.\" OpenGroup's Single Unix specification
11.\" http://www.UNIX-systems.org/online.html
fea681da 12.\"
269e8424
MK
13.\" 2007-03-31 Bruno Haible, Describe the glibc/libiconv //TRANSLIT
14.\" and //IGNORE extensions for 'tocode'.
15.\"
16.TH ICONV_OPEN 3 2007-03-31 "GNU" "Linux Programmer's Manual"
fea681da
MK
17.SH NAME
18iconv_open \- allocate descriptor for character set conversion
19.SH SYNOPSIS
20.nf
21.B #include <iconv.h>
22.sp
23.BI "iconv_t iconv_open(const char *" tocode ", const char *" fromcode );
24.fi
25.SH DESCRIPTION
60a90ecd
MK
26The
27.BR iconv_open ()
28function allocates a conversion descriptor suitable
fea681da
MK
29for converting byte sequences from character encoding \fIfromcode\fP to
30character encoding \fItocode\fP.
31.PP
32The values permitted for \fIfromcode\fP and \fItocode\fP and the supported
c13182ef
MK
33combinations are system dependent.
34For the GNU C library, the permitted
c65433e6 35values are listed by the \fBiconv \-\-list\fP command, and all combinations
fea681da 36of the listed values are supported.
269e8424
MK
37Furthermore the GNU C library and the
38GNU libiconv library support the following two suffixes:
39.TP
40//TRANSLIT
41When the string "//TRANSLIT" is appended to \fItocode\fP, transliteration
42is activated.
43This means that when a character cannot be represented in the
44target character set, it can be approximated through one or several
45similarly looking characters.
46.TP
47//IGNORE
48When the string "//IGNORE" is appended to \fItocode\fP, characters that
49cannot be represented in the target character set will be silently discarded.
fea681da 50.PP
60a90ecd
MK
51The resulting conversion descriptor can be used with
52.BR iconv ()
269e8424 53any number of times.
60a90ecd
MK
54It remains valid until deallocated using
55.BR iconv_close ().
fea681da 56.PP
c13182ef
MK
57A conversion descriptor contains a conversion state.
58After creation using
60a90ecd
MK
59.BR iconv_open (),
60the state is in the initial state.
61Using
62.BR iconv ()
c13182ef
MK
63modifies the descriptor's conversion state.
64(This implies that a conversion
65descriptor can not be used in multiple threads simultaneously.)
60a90ecd
MK
66To bring the state back to the initial state, use
67.BR iconv ()
c13182ef 68with NULL as \fIinbuf\fP argument.
fea681da 69.SH "RETURN VALUE"
60a90ecd
MK
70The
71.BR iconv_open ()
72function returns a freshly allocated conversion
c13182ef
MK
73descriptor.
74In case of error, it sets \fIerrno\fP and returns (iconv_t)(\-1).
fea681da
MK
75.SH ERRORS
76The following error can occur, among others:
77.TP
78.B EINVAL
79The conversion from \fIfromcode\fP to \fItocode\fP is not supported by the
80implementation.
81.SH "CONFORMING TO"
68e1685c 82UNIX98, POSIX.1-2001.
fea681da
MK
83.SH "SEE ALSO"
84.BR iconv (1),
85.BR iconv (3),
86.BR iconv_close (3)