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