1ICONV_OPEN(3)              Linux Programmer's Manual             ICONV_OPEN(3)
2
3
4

NAME

6       iconv_open - allocate descriptor for character set conversion
7

SYNOPSIS

9       #include <iconv.h>
10
11       iconv_t iconv_open(const char *tocode, const char *fromcode);
12

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

VERSIONS

55       This function is available in glibc since version 2.1.
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

CONFORMING TO

68       POSIX.1-2001, POSIX.1-2008, SUSv2.
69

SEE ALSO

71       iconv(1), iconv(3), iconv_close(3)
72

COLOPHON

74       This page is part of release 5.13 of the Linux  man-pages  project.   A
75       description  of  the project, information about reporting bugs, and the
76       latest    version    of    this    page,    can     be     found     at
77       https://www.kernel.org/doc/man-pages/.
78
79
80
81GNU                               2021-03-22                     ICONV_OPEN(3)
Impressum