]>
Commit | Line | Data |
---|---|---|
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 | .\" |
4c1c5274 | 13 | .TH iconv_open 3 (date) "Linux man-pages (unreleased)" |
fea681da MK |
14 | .SH NAME |
15 | iconv_open \- allocate descriptor for character set conversion | |
4508f8a0 AC |
16 | .SH LIBRARY |
17 | Standard 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 |
26 | The |
27 | .BR iconv_open () | |
28 | function allocates a conversion descriptor suitable | |
c6fa0841 MK |
29 | for converting byte sequences from character encoding |
30 | .I fromcode | |
31 | to | |
32 | character encoding | |
33 | .IR tocode . | |
fea681da | 34 | .PP |
c6fa0841 | 35 | The values permitted for |
1ae6b2c7 | 36 | .I fromcode |
c6fa0841 MK |
37 | and |
38 | .I tocode | |
39 | and the supported | |
a43eed0c | 40 | combinations are system-dependent. |
c13182ef | 41 | For the GNU C library, the permitted |
51700fd7 | 42 | values are listed by the |
c6fa0841 MK |
43 | .I "iconv \-\-list" |
44 | command, and all combinations | |
fea681da | 45 | of the listed values are supported. |
269e8424 MK |
46 | Furthermore the GNU C library and the |
47 | GNU libiconv library support the following two suffixes: | |
48 | .TP | |
49 | //TRANSLIT | |
c6fa0841 MK |
50 | When the string "//TRANSLIT" is appended to |
51 | .IR tocode , | |
52 | transliteration | |
269e8424 MK |
53 | is activated. |
54 | This means that when a character cannot be represented in the | |
55 | target character set, it can be approximated through one or several | |
56 | similarly looking characters. | |
57 | .TP | |
58 | //IGNORE | |
c6fa0841 MK |
59 | When the string "//IGNORE" is appended to |
60 | .IR tocode , | |
61 | characters that | |
269e8424 | 62 | cannot be represented in the target character set will be silently discarded. |
fea681da | 63 | .PP |
60a90ecd | 64 | The resulting conversion descriptor can be used with |
988db661 | 65 | .BR iconv (3) |
269e8424 | 66 | any number of times. |
60a90ecd | 67 | It remains valid until deallocated using |
3a72373c | 68 | .BR iconv_close (3). |
fea681da | 69 | .PP |
c13182ef MK |
70 | A conversion descriptor contains a conversion state. |
71 | After creation using | |
60a90ecd MK |
72 | .BR iconv_open (), |
73 | the state is in the initial state. | |
74 | Using | |
3a72373c | 75 | .BR iconv (3) |
c13182ef | 76 | modifies the descriptor's conversion state. |
60a90ecd | 77 | To bring the state back to the initial state, use |
3a72373c | 78 | .BR iconv (3) |
c6fa0841 MK |
79 | with NULL as |
80 | .I inbuf | |
81 | argument. | |
47297adb | 82 | .SH RETURN VALUE |
7a6227d3 | 83 | On success, |
60a90ecd | 84 | .BR iconv_open () |
7a6227d3 | 85 | returns a freshly allocated conversion |
c13182ef | 86 | descriptor. |
7a6227d3 | 87 | On failure, it returns |
1ae6b2c7 | 88 | .I (iconv_t)\ \-1 |
7a6227d3 | 89 | and sets |
c6fa0841 | 90 | .I errno |
7a6227d3 | 91 | to indicate the error. |
fea681da MK |
92 | .SH ERRORS |
93 | The following error can occur, among others: | |
94 | .TP | |
95 | .B EINVAL | |
c6fa0841 | 96 | The conversion from |
1ae6b2c7 | 97 | .I fromcode |
c6fa0841 MK |
98 | to |
99 | .I tocode | |
100 | is not supported by the | |
fea681da | 101 | implementation. |
3fd4929b | 102 | .SH VERSIONS |
b324e17d | 103 | This function is available since glibc 2.1. |
9a8b397f MS |
104 | .SH ATTRIBUTES |
105 | For 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 |
110 | allbox; | |
c466875e | 111 | lbx lb lb |
9a8b397f MS |
112 | l l l. |
113 | Interface Attribute Value | |
114 | T{ | |
115 | .BR iconv_open () | |
116 | T} Thread safety MT-Safe locale | |
117 | .TE | |
c466875e MK |
118 | .hy |
119 | .ad | |
847e0d88 | 120 | .sp 1 |
3113c7f3 | 121 | .SH STANDARDS |
6c90b6d4 | 122 | POSIX.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) |