1ICONV_OPEN(3) Linux Programmer's Manual ICONV_OPEN(3)
2
3
4
6 iconv_open - allocate descriptor for character set conversion
7
9 #include <iconv.h>
10
11 iconv_t iconv_open(const char *tocode, const char *fromcode);
12
14 The iconv_open() function allocates a conversion descriptor suitable
15 for converting byte sequences from character encoding fromcode to char‐
16 acter encoding tocode.
17
18 The values permitted for fromcode and tocode and the supported combina‐
19 tions are system dependent. For the GNU C library, the permitted values
20 are listed by the iconv --list command, and all combinations of the
21 listed values are supported.
22
23 The resulting conversion descriptor can be used with iconv() any number
24 of times. It remains valid until deallocated using iconv_close().
25
26 A conversion descriptor contains a conversion state. After creation
27 using iconv_open(), the state is in the initial state. Using iconv()
28 modifies the descriptor's conversion state. (This implies that a con‐
29 version descriptor can not be used in multiple threads simultaneously.)
30 To bring the state back to the initial state, use iconv() with NULL as
31 inbuf argument.
32
34 The iconv_open() function returns a freshly allocated conversion
35 descriptor. In case of error, it sets errno and returns (iconv_t)(-1).
36
38 The following error can occur, among others:
39
40 EINVAL The conversion from fromcode to tocode is not supported by the
41 implementation.
42
44 UNIX98, POSIX.1-2001.
45
47 iconv(1), iconv(3), iconv_close(3)
48
49
50
51GNU 1999-11-27 ICONV_OPEN(3)