]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) Bruno Haible <haible@clisp.cons.org> |
2 | .\" | |
89e3ffe9 | 3 | .\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA) |
fea681da MK |
4 | .\" This is free documentation; you can redistribute it and/or |
5 | .\" modify it under the terms of the GNU General Public License as | |
6 | .\" published by the Free Software Foundation; either version 2 of | |
7 | .\" the License, or (at your option) any later version. | |
fe382ebf | 8 | .\" %%%LICENSE_END |
fea681da MK |
9 | .\" |
10 | .\" References consulted: | |
11 | .\" GNU glibc-2 source code and manual | |
008f1ecc | 12 | .\" OpenGroup's Single UNIX specification |
269e8424 | 13 | .\" http://www.UNIX-systems.org/online.html |
fea681da | 14 | .\" |
988db661 MK |
15 | .\" 2007-03-31 Bruno Haible, Describe the glibc/libiconv //TRANSLIT |
16 | .\" and //IGNORE extensions for 'tocode'. | |
269e8424 | 17 | .\" |
3fd4929b | 18 | .TH ICONV_OPEN 3 2008-08-11 "GNU" "Linux Programmer's Manual" |
fea681da MK |
19 | .SH NAME |
20 | iconv_open \- allocate descriptor for character set conversion | |
21 | .SH SYNOPSIS | |
22 | .nf | |
23 | .B #include <iconv.h> | |
24 | .sp | |
25 | .BI "iconv_t iconv_open(const char *" tocode ", const char *" fromcode ); | |
26 | .fi | |
27 | .SH DESCRIPTION | |
60a90ecd MK |
28 | The |
29 | .BR iconv_open () | |
30 | function allocates a conversion descriptor suitable | |
fea681da MK |
31 | for converting byte sequences from character encoding \fIfromcode\fP to |
32 | character encoding \fItocode\fP. | |
33 | .PP | |
34 | The values permitted for \fIfromcode\fP and \fItocode\fP and the supported | |
a43eed0c | 35 | combinations are system-dependent. |
c13182ef | 36 | For the GNU C library, the permitted |
c65433e6 | 37 | values are listed by the \fBiconv \-\-list\fP command, and all combinations |
fea681da | 38 | of the listed values are supported. |
269e8424 MK |
39 | Furthermore the GNU C library and the |
40 | GNU libiconv library support the following two suffixes: | |
41 | .TP | |
42 | //TRANSLIT | |
43 | When the string "//TRANSLIT" is appended to \fItocode\fP, transliteration | |
44 | is activated. | |
45 | This means that when a character cannot be represented in the | |
46 | target character set, it can be approximated through one or several | |
47 | similarly looking characters. | |
48 | .TP | |
49 | //IGNORE | |
50 | When the string "//IGNORE" is appended to \fItocode\fP, characters that | |
51 | cannot be represented in the target character set will be silently discarded. | |
fea681da | 52 | .PP |
60a90ecd | 53 | The resulting conversion descriptor can be used with |
988db661 | 54 | .BR iconv (3) |
269e8424 | 55 | any number of times. |
60a90ecd | 56 | It remains valid until deallocated using |
3a72373c | 57 | .BR iconv_close (3). |
fea681da | 58 | .PP |
c13182ef MK |
59 | A conversion descriptor contains a conversion state. |
60 | After creation using | |
60a90ecd MK |
61 | .BR iconv_open (), |
62 | the state is in the initial state. | |
63 | Using | |
3a72373c | 64 | .BR iconv (3) |
c13182ef MK |
65 | modifies the descriptor's conversion state. |
66 | (This implies that a conversion | |
67 | descriptor can not be used in multiple threads simultaneously.) | |
60a90ecd | 68 | To bring the state back to the initial state, use |
3a72373c | 69 | .BR iconv (3) |
c13182ef | 70 | with NULL as \fIinbuf\fP argument. |
47297adb | 71 | .SH RETURN VALUE |
60a90ecd MK |
72 | The |
73 | .BR iconv_open () | |
74 | function returns a freshly allocated conversion | |
c13182ef | 75 | descriptor. |
7d2cb9d5 | 76 | In case of error, it sets \fIerrno\fP and returns |
009df872 | 77 | .IR (iconv_t)\ \-1 . |
fea681da MK |
78 | .SH ERRORS |
79 | The following error can occur, among others: | |
80 | .TP | |
81 | .B EINVAL | |
82 | The conversion from \fIfromcode\fP to \fItocode\fP is not supported by the | |
83 | implementation. | |
3fd4929b MK |
84 | .SH VERSIONS |
85 | This function is available in glibc since version 2.1. | |
47297adb | 86 | .SH CONFORMING TO |
68e1685c | 87 | UNIX98, POSIX.1-2001. |
47297adb | 88 | .SH SEE ALSO |
fea681da MK |
89 | .BR iconv (1), |
90 | .BR iconv (3), | |
91 | .BR iconv_close (3) |