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