sl@0
|
1 |
/*
|
sl@0
|
2 |
**********************************************************************
|
sl@0
|
3 |
* Copyright (C) 1999-2005, International Business Machines
|
sl@0
|
4 |
* Corporation and others. All Rights Reserved.
|
sl@0
|
5 |
**********************************************************************
|
sl@0
|
6 |
*
|
sl@0
|
7 |
*
|
sl@0
|
8 |
* ucnv_err.h:
|
sl@0
|
9 |
*/
|
sl@0
|
10 |
|
sl@0
|
11 |
/**
|
sl@0
|
12 |
* \file
|
sl@0
|
13 |
* \brief C UConverter predefined error callbacks
|
sl@0
|
14 |
*
|
sl@0
|
15 |
* <h2>Error Behaviour Functions</h2>
|
sl@0
|
16 |
* Defines some error behaviour functions called by ucnv_{from,to}Unicode
|
sl@0
|
17 |
* These are provided as part of ICU and many are stable, but they
|
sl@0
|
18 |
* can also be considered only as an example of what can be done with
|
sl@0
|
19 |
* callbacks. You may of course write your own.
|
sl@0
|
20 |
*
|
sl@0
|
21 |
* If you want to write your own, you may also find the functions from
|
sl@0
|
22 |
* ucnv_cb.h useful when writing your own callbacks.
|
sl@0
|
23 |
*
|
sl@0
|
24 |
* These functions, although public, should NEVER be called directly.
|
sl@0
|
25 |
* They should be used as parameters to the ucnv_setFromUCallback
|
sl@0
|
26 |
* and ucnv_setToUCallback functions, to set the behaviour of a converter
|
sl@0
|
27 |
* when it encounters ILLEGAL/UNMAPPED/INVALID sequences.
|
sl@0
|
28 |
*
|
sl@0
|
29 |
* usage example: 'STOP' doesn't need any context, but newContext
|
sl@0
|
30 |
* could be set to something other than 'NULL' if needed. The available
|
sl@0
|
31 |
* contexts in this header can modify the default behavior of the callback.
|
sl@0
|
32 |
*
|
sl@0
|
33 |
* \code
|
sl@0
|
34 |
* UErrorCode err = U_ZERO_ERROR;
|
sl@0
|
35 |
* UConverter *myConverter = ucnv_open("ibm-949", &err);
|
sl@0
|
36 |
* const void *oldContext;
|
sl@0
|
37 |
* UConverterFromUCallback oldAction;
|
sl@0
|
38 |
*
|
sl@0
|
39 |
*
|
sl@0
|
40 |
* if (U_SUCCESS(err))
|
sl@0
|
41 |
* {
|
sl@0
|
42 |
* ucnv_setFromUCallBack(myConverter,
|
sl@0
|
43 |
* UCNV_FROM_U_CALLBACK_STOP,
|
sl@0
|
44 |
* NULL,
|
sl@0
|
45 |
* &oldAction,
|
sl@0
|
46 |
* &oldContext,
|
sl@0
|
47 |
* &status);
|
sl@0
|
48 |
* }
|
sl@0
|
49 |
* \endcode
|
sl@0
|
50 |
*
|
sl@0
|
51 |
* The code above tells "myConverter" to stop when it encounters an
|
sl@0
|
52 |
* ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from
|
sl@0
|
53 |
* Unicode -> Codepage. The behavior from Codepage to Unicode is not changed,
|
sl@0
|
54 |
* and ucnv_setToUCallBack would need to be called in order to change
|
sl@0
|
55 |
* that behavior too.
|
sl@0
|
56 |
*
|
sl@0
|
57 |
* Here is an example with a context:
|
sl@0
|
58 |
*
|
sl@0
|
59 |
* \code
|
sl@0
|
60 |
* UErrorCode err = U_ZERO_ERROR;
|
sl@0
|
61 |
* UConverter *myConverter = ucnv_open("ibm-949", &err);
|
sl@0
|
62 |
* const void *oldContext;
|
sl@0
|
63 |
* UConverterFromUCallback oldAction;
|
sl@0
|
64 |
*
|
sl@0
|
65 |
*
|
sl@0
|
66 |
* if (U_SUCCESS(err))
|
sl@0
|
67 |
* {
|
sl@0
|
68 |
* ucnv_setToUCallBack(myConverter,
|
sl@0
|
69 |
* UCNV_TO_U_CALLBACK_SUBSTITUTE,
|
sl@0
|
70 |
* UCNV_SUB_STOP_ON_ILLEGAL,
|
sl@0
|
71 |
* &oldAction,
|
sl@0
|
72 |
* &oldContext,
|
sl@0
|
73 |
* &status);
|
sl@0
|
74 |
* }
|
sl@0
|
75 |
* \endcode
|
sl@0
|
76 |
*
|
sl@0
|
77 |
* The code above tells "myConverter" to stop when it encounters an
|
sl@0
|
78 |
* ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from
|
sl@0
|
79 |
* Codepage -> Unicode. Any unmapped and legal characters will be
|
sl@0
|
80 |
* substituted to be the default substitution character.
|
sl@0
|
81 |
*/
|
sl@0
|
82 |
|
sl@0
|
83 |
#ifndef UCNV_ERR_H
|
sl@0
|
84 |
#define UCNV_ERR_H
|
sl@0
|
85 |
|
sl@0
|
86 |
#include "unicode/utypes.h"
|
sl@0
|
87 |
|
sl@0
|
88 |
#if !UCONFIG_NO_CONVERSION
|
sl@0
|
89 |
|
sl@0
|
90 |
/** Forward declaring the UConverter structure. @stable ICU 2.0 */
|
sl@0
|
91 |
struct UConverter;
|
sl@0
|
92 |
|
sl@0
|
93 |
/** @stable ICU 2.0 */
|
sl@0
|
94 |
typedef struct UConverter UConverter;
|
sl@0
|
95 |
|
sl@0
|
96 |
/**
|
sl@0
|
97 |
* FROM_U, TO_U context options for sub callback
|
sl@0
|
98 |
* @stable ICU 2.0
|
sl@0
|
99 |
*/
|
sl@0
|
100 |
#define UCNV_SUB_STOP_ON_ILLEGAL "i"
|
sl@0
|
101 |
|
sl@0
|
102 |
/**
|
sl@0
|
103 |
* FROM_U, TO_U context options for skip callback
|
sl@0
|
104 |
* @stable ICU 2.0
|
sl@0
|
105 |
*/
|
sl@0
|
106 |
#define UCNV_SKIP_STOP_ON_ILLEGAL "i"
|
sl@0
|
107 |
|
sl@0
|
108 |
/**
|
sl@0
|
109 |
* FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX)
|
sl@0
|
110 |
* @stable ICU 2.0
|
sl@0
|
111 |
*/
|
sl@0
|
112 |
#define UCNV_ESCAPE_ICU NULL
|
sl@0
|
113 |
/**
|
sl@0
|
114 |
* FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to JAVA (\\uXXXX)
|
sl@0
|
115 |
* @stable ICU 2.0
|
sl@0
|
116 |
*/
|
sl@0
|
117 |
#define UCNV_ESCAPE_JAVA "J"
|
sl@0
|
118 |
/**
|
sl@0
|
119 |
* FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX)
|
sl@0
|
120 |
* TO_U_CALLBACK_ESCAPE option to escape the character value accoding to C (\\xXXXX)
|
sl@0
|
121 |
* @stable ICU 2.0
|
sl@0
|
122 |
*/
|
sl@0
|
123 |
#define UCNV_ESCAPE_C "C"
|
sl@0
|
124 |
/**
|
sl@0
|
125 |
* FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly
|
sl@0
|
126 |
* TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly
|
sl@0
|
127 |
* @stable ICU 2.0
|
sl@0
|
128 |
*/
|
sl@0
|
129 |
#define UCNV_ESCAPE_XML_DEC "D"
|
sl@0
|
130 |
/**
|
sl@0
|
131 |
* FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly
|
sl@0
|
132 |
* TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly
|
sl@0
|
133 |
* @stable ICU 2.0
|
sl@0
|
134 |
*/
|
sl@0
|
135 |
#define UCNV_ESCAPE_XML_HEX "X"
|
sl@0
|
136 |
/**
|
sl@0
|
137 |
* FROM_U_CALLBACK_ESCAPE context option to escape teh code unit according to Unicode (U+XXXXX)
|
sl@0
|
138 |
* @stable ICU 2.0
|
sl@0
|
139 |
*/
|
sl@0
|
140 |
#define UCNV_ESCAPE_UNICODE "U"
|
sl@0
|
141 |
|
sl@0
|
142 |
/**
|
sl@0
|
143 |
* The process condition code to be used with the callbacks.
|
sl@0
|
144 |
* Codes which are greater than UCNV_IRREGULAR should be
|
sl@0
|
145 |
* passed on to any chained callbacks.
|
sl@0
|
146 |
* @stable ICU 2.0
|
sl@0
|
147 |
*/
|
sl@0
|
148 |
typedef enum {
|
sl@0
|
149 |
UCNV_UNASSIGNED = 0, /**< The code point is unassigned.
|
sl@0
|
150 |
The error code U_INVALID_CHAR_FOUND will be set. */
|
sl@0
|
151 |
UCNV_ILLEGAL = 1, /**< The code point is illegal. For example,
|
sl@0
|
152 |
\\x81\\x2E is illegal in SJIS because \\x2E
|
sl@0
|
153 |
is not a valid trail byte for the \\x81
|
sl@0
|
154 |
lead byte.
|
sl@0
|
155 |
Also, starting with Unicode 3.0.1, non-shortest byte sequences
|
sl@0
|
156 |
in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061)
|
sl@0
|
157 |
are also illegal, not just irregular.
|
sl@0
|
158 |
The error code U_ILLEGAL_CHAR_FOUND will be set. */
|
sl@0
|
159 |
UCNV_IRREGULAR = 2, /**< The codepoint is not a regular sequence in
|
sl@0
|
160 |
the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF
|
sl@0
|
161 |
are irregular UTF-8 byte sequences for single surrogate
|
sl@0
|
162 |
code points.
|
sl@0
|
163 |
The error code U_INVALID_CHAR_FOUND will be set. */
|
sl@0
|
164 |
UCNV_RESET = 3, /**< The callback is called with this reason when a
|
sl@0
|
165 |
'reset' has occured. Callback should reset all
|
sl@0
|
166 |
state. */
|
sl@0
|
167 |
UCNV_CLOSE = 4, /**< Called when the converter is closed. The
|
sl@0
|
168 |
callback should release any allocated memory.*/
|
sl@0
|
169 |
UCNV_CLONE = 5 /**< Called when ucnv_safeClone() is called on the
|
sl@0
|
170 |
converter. the pointer available as the
|
sl@0
|
171 |
'context' is an alias to the original converters'
|
sl@0
|
172 |
context pointer. If the context must be owned
|
sl@0
|
173 |
by the new converter, the callback must clone
|
sl@0
|
174 |
the data and call ucnv_setFromUCallback
|
sl@0
|
175 |
(or setToUCallback) with the correct pointer.
|
sl@0
|
176 |
@stable ICU 2.2
|
sl@0
|
177 |
*/
|
sl@0
|
178 |
} UConverterCallbackReason;
|
sl@0
|
179 |
|
sl@0
|
180 |
|
sl@0
|
181 |
/**
|
sl@0
|
182 |
* The structure for the fromUnicode callback function parameter.
|
sl@0
|
183 |
* @stable ICU 2.0
|
sl@0
|
184 |
*/
|
sl@0
|
185 |
typedef struct {
|
sl@0
|
186 |
uint16_t size; /**< The size of this struct. @stable ICU 2.0 */
|
sl@0
|
187 |
UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */
|
sl@0
|
188 |
UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */
|
sl@0
|
189 |
const UChar *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */
|
sl@0
|
190 |
const UChar *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */
|
sl@0
|
191 |
char *target; /**< Pointer to the target buffer. @stable ICU 2.0 */
|
sl@0
|
192 |
const char *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */
|
sl@0
|
193 |
int32_t *offsets; /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */
|
sl@0
|
194 |
} UConverterFromUnicodeArgs;
|
sl@0
|
195 |
|
sl@0
|
196 |
|
sl@0
|
197 |
/**
|
sl@0
|
198 |
* The structure for the toUnicode callback function parameter.
|
sl@0
|
199 |
* @stable ICU 2.0
|
sl@0
|
200 |
*/
|
sl@0
|
201 |
typedef struct {
|
sl@0
|
202 |
uint16_t size; /**< The size of this struct @stable ICU 2.0 */
|
sl@0
|
203 |
UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */
|
sl@0
|
204 |
UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */
|
sl@0
|
205 |
const char *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */
|
sl@0
|
206 |
const char *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */
|
sl@0
|
207 |
UChar *target; /**< Pointer to the target buffer. @stable ICU 2.0 */
|
sl@0
|
208 |
const UChar *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */
|
sl@0
|
209 |
int32_t *offsets; /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */
|
sl@0
|
210 |
} UConverterToUnicodeArgs;
|
sl@0
|
211 |
|
sl@0
|
212 |
|
sl@0
|
213 |
/**
|
sl@0
|
214 |
* DO NOT CALL THIS FUNCTION DIRECTLY!
|
sl@0
|
215 |
* This From Unicode callback STOPS at the ILLEGAL_SEQUENCE,
|
sl@0
|
216 |
* returning the error code back to the caller immediately.
|
sl@0
|
217 |
*
|
sl@0
|
218 |
* @param context Pointer to the callback's private data
|
sl@0
|
219 |
* @param fromUArgs Information about the conversion in progress
|
sl@0
|
220 |
* @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
|
sl@0
|
221 |
* @param length Size (in bytes) of the concerned codepage sequence
|
sl@0
|
222 |
* @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
|
sl@0
|
223 |
* @param reason Defines the reason the callback was invoked
|
sl@0
|
224 |
* @param err This should always be set to a failure status prior to calling.
|
sl@0
|
225 |
* @stable ICU 2.0
|
sl@0
|
226 |
*/
|
sl@0
|
227 |
U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP (
|
sl@0
|
228 |
const void *context,
|
sl@0
|
229 |
UConverterFromUnicodeArgs *fromUArgs,
|
sl@0
|
230 |
const UChar* codeUnits,
|
sl@0
|
231 |
int32_t length,
|
sl@0
|
232 |
UChar32 codePoint,
|
sl@0
|
233 |
UConverterCallbackReason reason,
|
sl@0
|
234 |
UErrorCode * err);
|
sl@0
|
235 |
|
sl@0
|
236 |
|
sl@0
|
237 |
|
sl@0
|
238 |
/**
|
sl@0
|
239 |
* DO NOT CALL THIS FUNCTION DIRECTLY!
|
sl@0
|
240 |
* This To Unicode callback STOPS at the ILLEGAL_SEQUENCE,
|
sl@0
|
241 |
* returning the error code back to the caller immediately.
|
sl@0
|
242 |
*
|
sl@0
|
243 |
* @param context Pointer to the callback's private data
|
sl@0
|
244 |
* @param toUArgs Information about the conversion in progress
|
sl@0
|
245 |
* @param codeUnits Points to 'length' bytes of the concerned codepage sequence
|
sl@0
|
246 |
* @param length Size (in bytes) of the concerned codepage sequence
|
sl@0
|
247 |
* @param reason Defines the reason the callback was invoked
|
sl@0
|
248 |
* @param err This should always be set to a failure status prior to calling.
|
sl@0
|
249 |
* @stable ICU 2.0
|
sl@0
|
250 |
*/
|
sl@0
|
251 |
U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP (
|
sl@0
|
252 |
const void *context,
|
sl@0
|
253 |
UConverterToUnicodeArgs *toUArgs,
|
sl@0
|
254 |
const char* codeUnits,
|
sl@0
|
255 |
int32_t length,
|
sl@0
|
256 |
UConverterCallbackReason reason,
|
sl@0
|
257 |
UErrorCode * err);
|
sl@0
|
258 |
|
sl@0
|
259 |
/**
|
sl@0
|
260 |
* DO NOT CALL THIS FUNCTION DIRECTLY!
|
sl@0
|
261 |
* This From Unicode callback skips any ILLEGAL_SEQUENCE, or
|
sl@0
|
262 |
* skips only UNASSINGED_SEQUENCE depending on the context parameter
|
sl@0
|
263 |
* simply ignoring those characters.
|
sl@0
|
264 |
*
|
sl@0
|
265 |
* @param context The function currently recognizes the callback options:
|
sl@0
|
266 |
* UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
|
sl@0
|
267 |
* returning the error code back to the caller immediately.
|
sl@0
|
268 |
* NULL: Skips any ILLEGAL_SEQUENCE
|
sl@0
|
269 |
* @param fromUArgs Information about the conversion in progress
|
sl@0
|
270 |
* @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
|
sl@0
|
271 |
* @param length Size (in bytes) of the concerned codepage sequence
|
sl@0
|
272 |
* @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
|
sl@0
|
273 |
* @param reason Defines the reason the callback was invoked
|
sl@0
|
274 |
* @param err Return value will be set to success if the callback was handled,
|
sl@0
|
275 |
* otherwise this value will be set to a failure status.
|
sl@0
|
276 |
* @stable ICU 2.0
|
sl@0
|
277 |
*/
|
sl@0
|
278 |
U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP (
|
sl@0
|
279 |
const void *context,
|
sl@0
|
280 |
UConverterFromUnicodeArgs *fromUArgs,
|
sl@0
|
281 |
const UChar* codeUnits,
|
sl@0
|
282 |
int32_t length,
|
sl@0
|
283 |
UChar32 codePoint,
|
sl@0
|
284 |
UConverterCallbackReason reason,
|
sl@0
|
285 |
UErrorCode * err);
|
sl@0
|
286 |
|
sl@0
|
287 |
/**
|
sl@0
|
288 |
* DO NOT CALL THIS FUNCTION DIRECTLY!
|
sl@0
|
289 |
* This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or
|
sl@0
|
290 |
* UNASSIGNED_SEQUENCE depending on context parameter, with the
|
sl@0
|
291 |
* current substitution string for the converter. This is the default
|
sl@0
|
292 |
* callback.
|
sl@0
|
293 |
*
|
sl@0
|
294 |
* @param context The function currently recognizes the callback options:
|
sl@0
|
295 |
* UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
|
sl@0
|
296 |
* returning the error code back to the caller immediately.
|
sl@0
|
297 |
* NULL: Substitutes any ILLEGAL_SEQUENCE
|
sl@0
|
298 |
* @param fromUArgs Information about the conversion in progress
|
sl@0
|
299 |
* @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
|
sl@0
|
300 |
* @param length Size (in bytes) of the concerned codepage sequence
|
sl@0
|
301 |
* @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
|
sl@0
|
302 |
* @param reason Defines the reason the callback was invoked
|
sl@0
|
303 |
* @param err Return value will be set to success if the callback was handled,
|
sl@0
|
304 |
* otherwise this value will be set to a failure status.
|
sl@0
|
305 |
* @see ucnv_setSubstChars
|
sl@0
|
306 |
* @stable ICU 2.0
|
sl@0
|
307 |
*/
|
sl@0
|
308 |
U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE (
|
sl@0
|
309 |
const void *context,
|
sl@0
|
310 |
UConverterFromUnicodeArgs *fromUArgs,
|
sl@0
|
311 |
const UChar* codeUnits,
|
sl@0
|
312 |
int32_t length,
|
sl@0
|
313 |
UChar32 codePoint,
|
sl@0
|
314 |
UConverterCallbackReason reason,
|
sl@0
|
315 |
UErrorCode * err);
|
sl@0
|
316 |
|
sl@0
|
317 |
/**
|
sl@0
|
318 |
* DO NOT CALL THIS FUNCTION DIRECTLY!
|
sl@0
|
319 |
* This From Unicode callback will Substitute the ILLEGAL SEQUENCE with the
|
sl@0
|
320 |
* hexadecimal representation of the illegal codepoints
|
sl@0
|
321 |
*
|
sl@0
|
322 |
* @param context The function currently recognizes the callback options:
|
sl@0
|
323 |
* <ul>
|
sl@0
|
324 |
* <li>UCNV_ESCAPE_ICU: Substitues the ILLEGAL SEQUENCE with the hexadecimal
|
sl@0
|
325 |
* representation in the format %UXXXX, e.g. "%uFFFE%u00AC%uC8FE").
|
sl@0
|
326 |
* In the Event the converter doesn't support the characters {%,U}[A-F][0-9],
|
sl@0
|
327 |
* it will substitute the illegal sequence with the substitution characters.
|
sl@0
|
328 |
* Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
|
sl@0
|
329 |
* %UD84D%UDC56</li>
|
sl@0
|
330 |
* <li>UCNV_ESCAPE_JAVA: Substitues the ILLEGAL SEQUENCE with the hexadecimal
|
sl@0
|
331 |
* representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE").
|
sl@0
|
332 |
* In the Event the converter doesn't support the characters {\,u}[A-F][0-9],
|
sl@0
|
333 |
* it will substitute the illegal sequence with the substitution characters.
|
sl@0
|
334 |
* Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
|
sl@0
|
335 |
* \\uD84D\\uDC56</li>
|
sl@0
|
336 |
* <li>UCNV_ESCAPE_C: Substitues the ILLEGAL SEQUENCE with the hexadecimal
|
sl@0
|
337 |
* representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE").
|
sl@0
|
338 |
* In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9],
|
sl@0
|
339 |
* it will substitute the illegal sequence with the substitution characters.
|
sl@0
|
340 |
* Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
|
sl@0
|
341 |
* \\U00023456</li>
|
sl@0
|
342 |
* <li>UCNV_ESCAPE_XML_DEC: Substitues the ILLEGAL SEQUENCE with the decimal
|
sl@0
|
343 |
* representation in the format \htmlonly&#DDDDDDDD;, e.g. "&#65534;&#172;&#51454;")\endhtmlonly.
|
sl@0
|
344 |
* In the Event the converter doesn't support the characters {&,#}[0-9],
|
sl@0
|
345 |
* it will substitute the illegal sequence with the substitution characters.
|
sl@0
|
346 |
* Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
|
sl@0
|
347 |
* &#144470; and Zero padding is ignored.</li>
|
sl@0
|
348 |
* <li>UCNV_ESCAPE_XML_HEX:Substitues the ILLEGAL SEQUENCE with the decimal
|
sl@0
|
349 |
* representation in the format \htmlonly&#xXXXX; e.g. "&#xFFFE;&#x00AC;&#xC8FE;")\endhtmlonly.
|
sl@0
|
350 |
* In the Event the converter doesn't support the characters {&,#,x}[0-9],
|
sl@0
|
351 |
* it will substitute the illegal sequence with the substitution characters.
|
sl@0
|
352 |
* Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
|
sl@0
|
353 |
* \htmlonly&#x23456;\endhtmlonly</li>
|
sl@0
|
354 |
* </ul>
|
sl@0
|
355 |
* @param fromUArgs Information about the conversion in progress
|
sl@0
|
356 |
* @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
|
sl@0
|
357 |
* @param length Size (in bytes) of the concerned codepage sequence
|
sl@0
|
358 |
* @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
|
sl@0
|
359 |
* @param reason Defines the reason the callback was invoked
|
sl@0
|
360 |
* @param err Return value will be set to success if the callback was handled,
|
sl@0
|
361 |
* otherwise this value will be set to a failure status.
|
sl@0
|
362 |
* @stable ICU 2.0
|
sl@0
|
363 |
*/
|
sl@0
|
364 |
U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE (
|
sl@0
|
365 |
const void *context,
|
sl@0
|
366 |
UConverterFromUnicodeArgs *fromUArgs,
|
sl@0
|
367 |
const UChar* codeUnits,
|
sl@0
|
368 |
int32_t length,
|
sl@0
|
369 |
UChar32 codePoint,
|
sl@0
|
370 |
UConverterCallbackReason reason,
|
sl@0
|
371 |
UErrorCode * err);
|
sl@0
|
372 |
|
sl@0
|
373 |
|
sl@0
|
374 |
/**
|
sl@0
|
375 |
* DO NOT CALL THIS FUNCTION DIRECTLY!
|
sl@0
|
376 |
* This To Unicode callback skips any ILLEGAL_SEQUENCE, or
|
sl@0
|
377 |
* skips only UNASSINGED_SEQUENCE depending on the context parameter
|
sl@0
|
378 |
* simply ignoring those characters.
|
sl@0
|
379 |
*
|
sl@0
|
380 |
* @param context The function currently recognizes the callback options:
|
sl@0
|
381 |
* UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
|
sl@0
|
382 |
* returning the error code back to the caller immediately.
|
sl@0
|
383 |
* NULL: Skips any ILLEGAL_SEQUENCE
|
sl@0
|
384 |
* @param toUArgs Information about the conversion in progress
|
sl@0
|
385 |
* @param codeUnits Points to 'length' bytes of the concerned codepage sequence
|
sl@0
|
386 |
* @param length Size (in bytes) of the concerned codepage sequence
|
sl@0
|
387 |
* @param reason Defines the reason the callback was invoked
|
sl@0
|
388 |
* @param err Return value will be set to success if the callback was handled,
|
sl@0
|
389 |
* otherwise this value will be set to a failure status.
|
sl@0
|
390 |
* @stable ICU 2.0
|
sl@0
|
391 |
*/
|
sl@0
|
392 |
U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP (
|
sl@0
|
393 |
const void *context,
|
sl@0
|
394 |
UConverterToUnicodeArgs *toUArgs,
|
sl@0
|
395 |
const char* codeUnits,
|
sl@0
|
396 |
int32_t length,
|
sl@0
|
397 |
UConverterCallbackReason reason,
|
sl@0
|
398 |
UErrorCode * err);
|
sl@0
|
399 |
|
sl@0
|
400 |
/**
|
sl@0
|
401 |
* DO NOT CALL THIS FUNCTION DIRECTLY!
|
sl@0
|
402 |
* This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or
|
sl@0
|
403 |
* UNASSIGNED_SEQUENCE depending on context parameter, with the
|
sl@0
|
404 |
* Unicode substitution character, U+FFFD.
|
sl@0
|
405 |
*
|
sl@0
|
406 |
* @param context The function currently recognizes the callback options:
|
sl@0
|
407 |
* UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
|
sl@0
|
408 |
* returning the error code back to the caller immediately.
|
sl@0
|
409 |
* NULL: Substitutes any ILLEGAL_SEQUENCE
|
sl@0
|
410 |
* @param toUArgs Information about the conversion in progress
|
sl@0
|
411 |
* @param codeUnits Points to 'length' bytes of the concerned codepage sequence
|
sl@0
|
412 |
* @param length Size (in bytes) of the concerned codepage sequence
|
sl@0
|
413 |
* @param reason Defines the reason the callback was invoked
|
sl@0
|
414 |
* @param err Return value will be set to success if the callback was handled,
|
sl@0
|
415 |
* otherwise this value will be set to a failure status.
|
sl@0
|
416 |
* @stable ICU 2.0
|
sl@0
|
417 |
*/
|
sl@0
|
418 |
U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE (
|
sl@0
|
419 |
const void *context,
|
sl@0
|
420 |
UConverterToUnicodeArgs *toUArgs,
|
sl@0
|
421 |
const char* codeUnits,
|
sl@0
|
422 |
int32_t length,
|
sl@0
|
423 |
UConverterCallbackReason reason,
|
sl@0
|
424 |
UErrorCode * err);
|
sl@0
|
425 |
|
sl@0
|
426 |
/**
|
sl@0
|
427 |
* DO NOT CALL THIS FUNCTION DIRECTLY!
|
sl@0
|
428 |
* This To Unicode callback will Substitute the ILLEGAL SEQUENCE with the
|
sl@0
|
429 |
* hexadecimal representation of the illegal bytes
|
sl@0
|
430 |
* (in the format %XNN, e.g. "%XFF%X0A%XC8%X03").
|
sl@0
|
431 |
*
|
sl@0
|
432 |
* @param context This function currently recognizes the callback options:
|
sl@0
|
433 |
* UCNV_ESCAPE_ICU, UCNV_ESCAPE_JAVA, UCNV_ESCAPE_C, UCNV_ESCAPE_XML_DEC,
|
sl@0
|
434 |
* UCNV_ESCAPE_XML_HEX and UCNV_ESCAPE_UNICODE.
|
sl@0
|
435 |
* @param toUArgs Information about the conversion in progress
|
sl@0
|
436 |
* @param codeUnits Points to 'length' bytes of the concerned codepage sequence
|
sl@0
|
437 |
* @param length Size (in bytes) of the concerned codepage sequence
|
sl@0
|
438 |
* @param reason Defines the reason the callback was invoked
|
sl@0
|
439 |
* @param err Return value will be set to success if the callback was handled,
|
sl@0
|
440 |
* otherwise this value will be set to a failure status.
|
sl@0
|
441 |
* @stable ICU 2.0
|
sl@0
|
442 |
*/
|
sl@0
|
443 |
|
sl@0
|
444 |
U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE (
|
sl@0
|
445 |
const void *context,
|
sl@0
|
446 |
UConverterToUnicodeArgs *toUArgs,
|
sl@0
|
447 |
const char* codeUnits,
|
sl@0
|
448 |
int32_t length,
|
sl@0
|
449 |
UConverterCallbackReason reason,
|
sl@0
|
450 |
UErrorCode * err);
|
sl@0
|
451 |
|
sl@0
|
452 |
#endif
|
sl@0
|
453 |
|
sl@0
|
454 |
#endif
|
sl@0
|
455 |
|
sl@0
|
456 |
/*UCNV_ERR_H*/
|