2 .\" Copyright (c) 2007, Sun Microsystems, Inc., All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH KICONV_OPEN 9F "Nov 5, 2013"
8 kiconv_open \- code conversion descriptor allocation function
12 #include <sys/sunddi.h>
16 \fBkiconv_t\fR \fBkiconv_open\fR(\fBconst\fR \fBchar *\fR\fItocode\fR, \fBconst\fR \fBchar *\fR\fIfromcode\fR);
22 Solaris DDI specific (Solaris DDI).
30 Points to a target codeset name string.
39 Points to a source codeset name string.
45 The \fBkiconv_open()\fR function returns a code conversion descriptor that
46 describes a conversion from the codeset specified by \fIfromcode\fR to the
47 codeset specified by \fItocode\fR. For state-dependent encodings, the
48 conversion descriptor is in a codeset-dependent initial state (ready for
49 immediate use with the \fBkiconv()\fR function).
52 Supported code conversions are between \fBUTF-8\fR and the following:
58 Big5 Traditional Chinese Big5
59 Big5-HKSCS Traditional Chinese Big5-Hong Kong
60 Supplementary Character Set
63 CP850 DOS Latin-1 (Western European)
64 CP852 DOS Latin-2 (Eastern European)
65 CP857 DOS Latin-5 (Turkish)
67 CP866 DOS Cyrillic Russian
68 CP932 Japanese Shift JIS (Windows)
69 CP950-HKSCS Traditional Chinese HKSCS-2001 (Windows)
78 EUC-CN Simplified Chinese EUC
80 EUC-JP-MS Japanese EUC MS
82 EUC-TW Traditional Chinese EUC
83 GB18030 Simplified Chinese GB18030
84 GBK Simplified Chinese GBK
85 ISO-8859-1 Latin-1 (Western European)
86 ISO-8859-2 Latin-2 (Eastern European)
87 ISO-8859-3 Latin-3 (Southern European)
88 ISO-8859-4 Latin-4 (Northern European)
93 ISO-8859-9 Latin-5 (Turkish)
94 ISO-8859-10 Latin-6 (Nordic)
95 ISO-8859-13 Latin-7 (Baltic)
96 ISO-8859-15 Latin-9 (Western European with euro sign)
98 Shift_JIS Japanese Shift JIS (JIS)
99 TIS_620 Thai (a.k.a. ISO 8859-11)
100 Unified-Hangul Korean Unified Hangul
108 \fBUTF-8\fR and the above names can be used at \fItocode\fR and \fIfromcode\fR
109 to specify the desired code conversion. The following aliases are also
110 supported as alternative names to be used:
114 Aliases Original Name
124 949, CP949 Unified-Hangul
142 A conversion descriptor remains valid until it is closed by using
143 \fBkiconv_close()\fR.
147 Upon successful completion, \fBkiconv_open()\fR returns a code conversion
148 descriptor for use on subsequent calls to \fBkiconv()\fR. Otherwise, if the
149 conversion specified by \fIfromcode\fR and \fItocode\fR is not supported or for
150 any other reasons the code conversion descriptor cannot be allocated,
151 \fBkiconv_open()\fR returns (\fBkiconv_t\fR)-1 to indicate the error.
155 \fBkiconv_open()\fR can be called from user context only.
158 \fBExample 1 \fROpening a Code Conversion
161 The following example shows how to open a code conversion from \fBISO\fR
162 8859-15 to \fBUTF-8\fR
167 #include <sys/sunddi.h>
171 cd = kiconv_open("UTF-8", "ISO-8859-15");
172 if (cd == (kiconv_t)-1) {
173 /* Cannot open up the code conversion. */
182 See \fBattributes\fR(5) for descriptions of the following attributes:
190 ATTRIBUTE TYPE ATTRIBUTE VALUE
192 Interface Stability Committed
198 \fBiconv\fR(3C), \fBiconv_close\fR(3C), \fBiconv_open\fR(3C),
199 \fBu8_strcmp\fR(3C), \fBu8_textprep_str\fR(3C), \fBu8_validate\fR(3C),
200 \fBuconv_u16tou32\fR(3C), \fBuconv_u16tou8\fR(3C), \fBuconv_u32tou16\fR(3C),
201 \fBuconv_u32tou8\fR(3C), \fBuconv_u8tou16\fR(3C), \fBuconv_u8tou32\fR(3C),
202 \fBattributes\fR(5), \fBkiconv\fR(9F), \fBkiconvstr\fR(9F),
203 \fBkiconv_close\fR(9F), \fBu8_strcmp\fR(9F), \fBu8_textprep_str\fR(9F),
204 \fBu8_validate\fR(9F), \fBuconv_u16tou32\fR(9F), \fBuconv_u16tou8\fR(9F),
205 \fBuconv_u32tou16\fR(9F), \fBuconv_u32tou8\fR(9F), \fBuconv_u8tou16\fR(9F),
206 \fBuconv_u8tou32\fR(9F)
212 http://www.unicode.org/standard/standard.html
216 The code conversions are available between \fBUTF-8\fR and the above noted
217 \fIcodesets\fR. For example, to convert from \fBEUC-JP \fRto \fBShift_JIS\fR,
218 first convert \fBEUC-JP\fR to \fBUTF-8\fR and then convert \fBUTF-8\fR to
222 The code conversions supported are based on simple one-to-one mappings. There
223 is no special treatment or processing done during code conversions such as case
224 conversion, Unicode Normalization, or mapping between combining or conjoining
225 sequences of \fBUTF-\fR8 and pre-composed characters in non-\fBUTF-8\fR
229 All supported non-\fBUTF-8\fR codesets use pre-composed characters only.
230 However, \fBUTF-8\fR allows combining or conjoining characters too. For this
231 reason, using a form of Unicode Normalizations on \fBUTF-8\fR text with
232 \fBu8_textprep_str()\fR before or after doing code conversions might be