]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/iconv_open.3
fmtmsg.3, gethostbyname.3, termios.3: Global fix: s/Unixware/UnixWare/
[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
988db661 10.\" OpenGroup's Single Unix specification
269e8424 11.\" http://www.UNIX-systems.org/online.html
fea681da 12.\"
988db661
MK
13.\" 2007-03-31 Bruno Haible, Describe the glibc/libiconv //TRANSLIT
14.\" and //IGNORE extensions for 'tocode'.
269e8424 15.\"
3fd4929b 16.TH ICONV_OPEN 3 2008-08-11 "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
a43eed0c 33combinations are system-dependent.
c13182ef 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 51The resulting conversion descriptor can be used with
988db661 52.BR iconv (3)
269e8424 53any number of times.
60a90ecd 54It remains valid until deallocated using
3a72373c 55.BR iconv_close (3).
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
3a72373c 62.BR iconv (3)
c13182ef
MK
63modifies the descriptor's conversion state.
64(This implies that a conversion
65descriptor can not be used in multiple threads simultaneously.)
60a90ecd 66To bring the state back to the initial state, use
3a72373c 67.BR iconv (3)
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 73descriptor.
7d2cb9d5 74In case of error, it sets \fIerrno\fP and returns
009df872 75.IR (iconv_t)\ \-1 .
fea681da
MK
76.SH ERRORS
77The following error can occur, among others:
78.TP
79.B EINVAL
80The conversion from \fIfromcode\fP to \fItocode\fP is not supported by the
81implementation.
3fd4929b
MK
82.SH VERSIONS
83This function is available in glibc since version 2.1.
fea681da 84.SH "CONFORMING TO"
68e1685c 85UNIX98, POSIX.1-2001.
fea681da
MK
86.SH "SEE ALSO"
87.BR iconv (1),
88.BR iconv (3),
89.BR iconv_close (3)