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