intl/icu/source/common/unicode/ucnv_err.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial