]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/iconv_open.3
Removed trailing white space at end of lines
[thirdparty/man-pages.git] / man3 / iconv_open.3
CommitLineData
fea681da
MK
1.\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
2.\"
89e3ffe9 3.\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
fea681da
MK
4.\" This is free documentation; you can redistribute it and/or
5.\" modify it under the terms of the GNU General Public License as
6.\" published by the Free Software Foundation; either version 2 of
7.\" the License, or (at your option) any later version.
fe382ebf 8.\" %%%LICENSE_END
fea681da
MK
9.\"
10.\" References consulted:
11.\" GNU glibc-2 source code and manual
008f1ecc 12.\" OpenGroup's Single UNIX specification
269e8424 13.\" http://www.UNIX-systems.org/online.html
fea681da 14.\"
988db661
MK
15.\" 2007-03-31 Bruno Haible, Describe the glibc/libiconv //TRANSLIT
16.\" and //IGNORE extensions for 'tocode'.
269e8424 17.\"
4b8c67d9 18.TH ICONV_OPEN 3 2017-09-15 "GNU" "Linux Programmer's Manual"
fea681da
MK
19.SH NAME
20iconv_open \- allocate descriptor for character set conversion
21.SH SYNOPSIS
22.nf
23.B #include <iconv.h>
68e4db0a 24.PP
fea681da
MK
25.BI "iconv_t iconv_open(const char *" tocode ", const char *" fromcode );
26.fi
27.SH DESCRIPTION
60a90ecd
MK
28The
29.BR iconv_open ()
30function allocates a conversion descriptor suitable
c6fa0841
MK
31for converting byte sequences from character encoding
32.I fromcode
33to
34character encoding
35.IR tocode .
fea681da 36.PP
c6fa0841 37The values permitted for
51700fd7 38.IR fromcode
c6fa0841
MK
39and
40.I tocode
41and the supported
a43eed0c 42combinations are system-dependent.
c13182ef 43For the GNU C library, the permitted
51700fd7 44values are listed by the
c6fa0841
MK
45.I "iconv \-\-list"
46command, and all combinations
fea681da 47of the listed values are supported.
269e8424
MK
48Furthermore the GNU C library and the
49GNU libiconv library support the following two suffixes:
50.TP
51//TRANSLIT
c6fa0841
MK
52When the string "//TRANSLIT" is appended to
53.IR tocode ,
54transliteration
269e8424
MK
55is activated.
56This means that when a character cannot be represented in the
57target character set, it can be approximated through one or several
58similarly looking characters.
59.TP
60//IGNORE
c6fa0841
MK
61When the string "//IGNORE" is appended to
62.IR tocode ,
63characters that
269e8424 64cannot be represented in the target character set will be silently discarded.
fea681da 65.PP
60a90ecd 66The resulting conversion descriptor can be used with
988db661 67.BR iconv (3)
269e8424 68any number of times.
60a90ecd 69It remains valid until deallocated using
3a72373c 70.BR iconv_close (3).
fea681da 71.PP
c13182ef
MK
72A conversion descriptor contains a conversion state.
73After creation using
60a90ecd
MK
74.BR iconv_open (),
75the state is in the initial state.
76Using
3a72373c 77.BR iconv (3)
c13182ef 78modifies the descriptor's conversion state.
60a90ecd 79To bring the state back to the initial state, use
3a72373c 80.BR iconv (3)
c6fa0841
MK
81with NULL as
82.I inbuf
83argument.
47297adb 84.SH RETURN VALUE
60a90ecd
MK
85The
86.BR iconv_open ()
87function returns a freshly allocated conversion
c13182ef 88descriptor.
c6fa0841
MK
89In case of error, it sets
90.I errno
91and returns
009df872 92.IR (iconv_t)\ \-1 .
fea681da
MK
93.SH ERRORS
94The following error can occur, among others:
95.TP
96.B EINVAL
c6fa0841 97The conversion from
51700fd7 98.IR fromcode
c6fa0841
MK
99to
100.I tocode
101is not supported by the
fea681da 102implementation.
3fd4929b
MK
103.SH VERSIONS
104This function is available in glibc since version 2.1.
9a8b397f
MS
105.SH ATTRIBUTES
106For an explanation of the terms used in this section, see
107.BR attributes (7).
108.TS
109allbox;
110lb lb lb
111l l l.
112Interface Attribute Value
113T{
114.BR iconv_open ()
115T} Thread safety MT-Safe locale
116.TE
847e0d88 117.sp 1
47297adb 118.SH CONFORMING TO
6c90b6d4 119POSIX.1-2001, POSIX.1-2008, SUSv2.
47297adb 120.SH SEE ALSO
fea681da
MK
121.BR iconv (1),
122.BR iconv (3),
123.BR iconv_close (3)