1iconv_open(3)              Library Functions Manual              iconv_open(3)
2
3
4

NAME

6       iconv_open - allocate descriptor for character set conversion
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <iconv.h>
13
14       iconv_t iconv_open(const char *tocode, const char *fromcode);
15

DESCRIPTION

17       The  iconv_open()  function  allocates a conversion descriptor suitable
18       for converting byte sequences from character encoding fromcode to char‐
19       acter encoding tocode.
20
21       The values permitted for fromcode and tocode and the supported combina‐
22       tions are system-dependent.  For the GNU C library, the permitted  val‐
23       ues are listed by the iconv --list command, and all combinations of the
24       listed values are supported.  Furthermore the GNU C library and the GNU
25       libiconv library support the following two suffixes:
26
27       //TRANSLIT
28              When the string "//TRANSLIT" is appended to tocode, translitera‐
29              tion is activated.  This means that when a character  cannot  be
30              represented  in the target character set, it can be approximated
31              through one or several similarly looking characters.
32
33       //IGNORE
34              When the string "//IGNORE" is  appended  to  tocode,  characters
35              that  cannot  be represented in the target character set will be
36              silently discarded.
37
38       The resulting conversion descriptor can be used with iconv(3) any  num‐
39       ber of times.  It remains valid until deallocated using iconv_close(3).
40
41       A  conversion  descriptor  contains a conversion state.  After creation
42       using iconv_open(), the state is in the initial state.  Using  iconv(3)
43       modifies the descriptor's conversion state.  To bring the state back to
44       the initial state, use iconv(3) with NULL as inbuf argument.
45

RETURN VALUE

47       On success, iconv_open() returns a  freshly  allocated  conversion  de‐
48       scriptor.   On failure, it returns (iconv_t) -1 and sets errno to indi‐
49       cate the error.
50

ERRORS

52       The following error can occur, among others:
53
54       EINVAL The conversion from fromcode to tocode is not supported  by  the
55              implementation.
56

ATTRIBUTES

58       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
59       tributes(7).
60
61       ┌─────────────────────────────────────┬───────────────┬────────────────┐
62Interface                            Attribute     Value          
63       ├─────────────────────────────────────┼───────────────┼────────────────┤
64iconv_open()                         │ Thread safety │ MT-Safe locale │
65       └─────────────────────────────────────┴───────────────┴────────────────┘
66

STANDARDS

68       POSIX.1-2008.
69

HISTORY

71       glibc 2.1.  POSIX.1-2001, SUSv2.
72

SEE ALSO

74       iconv(1), iconv(3), iconv_close(3)
75
76
77
78Linux man-pages 6.05              2023-07-20                     iconv_open(3)
Impressum