1kiconv_open(9F) Kernel Functions for Drivers kiconv_open(9F)
2
3
4
6 kiconv_open - code conversion descriptor allocation function
7
9 #include <sys/sunddi.h>
10
11
12
13 kiconv_t kiconv_open(const char *tocode, const char *fromcode);
14
15
17 Solaris DDI specific (Solaris DDI).
18
20 tocode Points to a target codeset name string.
21
22
23 fromcode Points to a source codeset name string.
24
25
27 The kiconv_open() function returns a code conversion descriptor that
28 describes a conversion from the codeset specified by fromcode to the
29 codeset specified by tocode. For state-dependent encodings, the conver‐
30 sion descriptor is in a codeset-dependent initial state (ready for
31 immediate use with the kiconv() function).
32
33
34 Supported code conversions are between UTF-8 and the following:
35
36 Name Description
37
38 Big5 Traditional Chinese Big5
39 Big5-HKSCS Traditional Chinese Big5-Hong Kong
40 Supplementary Character Set
41 CP720 DOS Arabic
42 CP737 DOS Greek
43 CP850 DOS Latin-1 (Western European)
44 CP852 DOS Latin-2 (Eastern European)
45 CP857 DOS Latin-5 (Turkish)
46 CP862 DOS Hebrew
47 CP866 DOS Cyrillic Russian
48 CP932 Japanese Shift JIS (Windows)
49 CP950-HKSCS Traditional Chinese HKSCS-2001 (Windows)
50 CP1250 Central Europe
51 CP1251 Cyrillic
52 CP1252 Western Europe
53 CP1253 Greek
54 CP1254 Turkish
55 CP1255 Hebrew
56 CP1256 Arabic
57 CP1257 Baltic
58 EUC-CN Simplified Chinese EUC
59 EUC-JP Japanese EUC
60 EUC-JP-MS Japanese EUC MS
61 EUC-KR Korean EUC
62 EUC-TW Traditional Chinese EUC
63 GB18030 Simplified Chinese GB18030
64 GBK Simplified Chinese GBK
65 ISO-8859-1 Latin-1 (Western European)
66 ISO-8859-2 Latin-2 (Eastern European)
67 ISO-8859-3 Latin-3 (Southern European)
68 ISO-8859-4 Latin-4 (Northern European)
69 ISO-8859-5 Cyrillic
70 ISO-8859-6 Arabic
71 ISO-8859-7 Greek
72 ISO-8859-8 Hebrew
73 ISO-8859-9 Latin-5 (Turkish)
74 ISO-8859-10 Latin-6 (Nordic)
75 ISO-8859-13 Latin-7 (Baltic)
76 ISO-8859-15 Latin-9 (Western European with euro sign)
77 KOI8-R Cyrillic
78 Shift_JIS Japanese Shift JIS (JIS)
79 TIS_620 Thai (a.k.a. ISO 8859-11)
80 Unified-Hangul Korean Unified Hangul
81
82
83
84
85
86 UTF-8 and the above names can be used at tocode and fromcode to specify
87 the desired code conversion. The following aliases are also supported
88 as alternative names to be used:
89
90 Aliases Original Name
91 720 CP720
92 737 CP737
93 850 CP850
94 852 CP852
95 857 CP857
96 862 CP862
97 866 CP866
98 932 CP932
99 936, CP936 GBK
100 949, CP949 Unified-Hangul
101 950, CP950 Big5
102 1250 CP1250
103 1251 CP1251
104 1252 CP1252
105 1253 CP1253
106 1254 CP1254
107 1255 CP1255
108 1256 CP1256
109 1257 CP1257
110 ISO-8859-11 TIS_620
111 PCK, SJIS Shift_JIS
112
113
114
115
116 A conversion descriptor remains valid until it is closed by using
117 kiconv_close().
118
120 Upon successful completion, kiconv_open() returns a code conversion
121 descriptor for use on subsequent calls to kiconv(). Otherwise, if the
122 conversion specified by fromcode and tocode is not supported or for any
123 other reasons the code conversion descriptor cannot be allocated,
124 kiconv_open() returns (kiconv_t)-1 to indicate the error.
125
127 kiconv_close() can be called from user context only.
128
130 Example 1 Opening a Code Conversion
131
132
133 The following example shows how to open a code conversion from ISO
134 8859-15 to UTF-8
135
136
137 #include <sys/sunddi.h>
138
139 kiconv_t cd;
140
141 cd = kiconv_open("UTF-8", "ISO-8859-15");
142 if (cd == (kiconv_t)-1) {
143 /* Cannot open up the code conversion. */
144 return (-1);
145 }
146
147
149 See attributes(5) for descriptions of the following attributes:
150
151
152
153
154 ┌─────────────────────────────┬─────────────────────────────┐
155 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
156 ├─────────────────────────────┼─────────────────────────────┤
157 │Interface Stability │Committed │
158 └─────────────────────────────┴─────────────────────────────┘
159
161 iconv(3C), iconv_close(3C), iconv_open(3C), u8_strcmp(3C),
162 u8_textprep_str(3C), u8_validate(3C), uconv_u16tou32(3C),
163 uconv_u16tou8(3C), uconv_u32tou16(3C), uconv_u32tou8(3C),
164 uconv_u8tou16(3C), uconv_u8tou32(3C), attributes(5), kiconv(9F), kicon‐
165 vstr(9F), kiconv_close(9F), u8_strcmp(9F), u8_textprep_str(9F), u8_val‐
166 idate(9F), uconv_u16tou32(9F), uconv_u16tou8(9F), uconv_u32tou16(9F),
167 uconv_u32tou8(9F), uconv_u8tou16(9F), uconv_u8tou32(9F)
168
169
170 The Unicode Standard
171
172
173 http://www.unicode.org/standard/standard.html
174
176 The code conversions are available between UTF-8 and the above noted
177 codesets. For example, to convert from EUC-JP to Shift_JIS, first con‐
178 vert EUC-JP to UTF-8 and then convert UTF-8 to Shift_JIS.
179
180
181 The code conversions supported are based on simple one-to-one mappings.
182 There is no special treatment or processing done during code conver‐
183 sions such as case conversion, Unicode Normalization, or mapping
184 between combining or conjoining sequences of UTF-8 and pre-composed
185 characters in non-UTF-8 codesets.
186
187
188 All supported non-UTF-8 codesets use pre-composed characters only. How‐
189 ever, UTF-8 allows combining or conjoining characters too. For this
190 reason, using a form of Unicode Normalizations on UTF-8 text with
191 u8_textprep_str() before or after doing code conversions might be nec‐
192 essary.
193
194
195
196SunOS 5.11 16 Oct 2007 kiconv_open(9F)