2 **********************************************************************
3 * Copyright (C) 2002-2004, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
8 * tab size: 8 (not used)
11 * created on: 2002jul01
12 * created by: Markus W. Scherer
14 * UTF-8 converter implementation. Used to be in ucnv_utf.c.
16 * Also, CESU-8 implementation, see UTR 26.
17 * The CESU-8 converter uses all the same functions as the
18 * UTF-8 converter, with a branch for converting supplementary code points.
21 #include "unicode/utypes.h"
23 #if !UCONFIG_NO_CONVERSION
25 #include "unicode/ucnv.h"
30 /* Prototypes --------------------------------------------------------------- */
32 /* Keep these here to make finicky compilers happy */
34 U_CFUNC
void ucnv_fromUnicode_UTF8(UConverterFromUnicodeArgs
*args
,
36 U_CFUNC
void ucnv_fromUnicode_UTF8_OFFSETS_LOGIC(UConverterFromUnicodeArgs
*args
,
40 /* UTF-8 -------------------------------------------------------------------- */
42 /* UTF-8 Conversion DATA
43 * for more information see Unicode Strandard 2.0 , Transformation Formats Appendix A-9
45 /*static const uint32_t REPLACEMENT_CHARACTER = 0x0000FFFD;*/
46 #define MAXIMUM_UCS2 0x0000FFFF
47 #define MAXIMUM_UTF 0x0010FFFF
48 #define MAXIMUM_UCS4 0x7FFFFFFF
50 #define HALF_BASE 0x0010000
51 #define HALF_MASK 0x3FF
52 #define SURROGATE_HIGH_START 0xD800
53 #define SURROGATE_HIGH_END 0xDBFF
54 #define SURROGATE_LOW_START 0xDC00
55 #define SURROGATE_LOW_END 0xDFFF
57 /* -SURROGATE_LOW_START + HALF_BASE */
58 #define SURROGATE_LOW_BASE 9216
60 static const uint32_t offsetsFromUTF8
[7] = {0,
61 (uint32_t) 0x00000000, (uint32_t) 0x00003080, (uint32_t) 0x000E2080,
62 (uint32_t) 0x03C82080, (uint32_t) 0xFA082080, (uint32_t) 0x82082080
65 /* END OF UTF-8 Conversion DATA */
67 static const int8_t bytesFromUTF8
[256] = {
68 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
69 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
70 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
71 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
72 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
73 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
74 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
75 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0
79 * Starting with Unicode 3.0.1:
80 * UTF-8 byte sequences of length N _must_ encode code points of or above utf8_minChar32[N];
81 * byte sequences with more than 4 bytes are illegal in UTF-8,
82 * which is tested with impossible values for them
85 utf8_minChar32
[7]={ 0, 0, 0x80, 0x800, 0x10000, 0xffffffff, 0xffffffff };
87 static void ucnv_toUnicode_UTF8 (UConverterToUnicodeArgs
* args
,
90 const unsigned char *mySource
= (unsigned char *) args
->source
;
91 UChar
*myTarget
= args
->target
;
92 const unsigned char *sourceLimit
= (unsigned char *) args
->sourceLimit
;
93 const UChar
*targetLimit
= args
->targetLimit
;
94 unsigned char *toUBytes
= args
->converter
->toUBytes
;
95 UBool isCESU8
= (UBool
)(args
->converter
->sharedData
== &_CESU8Data
);
99 /* Restore size of current sequence */
100 if (args
->converter
->toUnicodeStatus
&& myTarget
< targetLimit
)
102 inBytes
= args
->converter
->mode
; /* restore # of bytes to consume */
103 i
= args
->converter
->toULength
; /* restore # of bytes consumed */
105 ch
= args
->converter
->toUnicodeStatus
;/*Stores the previously calculated ch from a previous call*/
106 args
->converter
->toUnicodeStatus
= 0;
111 while (mySource
< sourceLimit
&& myTarget
< targetLimit
)
114 if (ch
< 0x80) /* Simple case */
116 *(myTarget
++) = (UChar
) ch
;
120 /* store the first char */
121 toUBytes
[0] = (char)ch
;
122 inBytes
= bytesFromUTF8
[ch
]; /* lookup current sequence length */
128 if (mySource
< sourceLimit
)
130 toUBytes
[i
] = (char) (ch2
= *mySource
);
131 if (!UTF8_IS_TRAIL(ch2
))
133 break; /* i < inBytes */
135 ch
= (ch
<< 6) + ch2
;
141 /* stores a partially calculated target*/
142 args
->converter
->toUnicodeStatus
= ch
;
143 args
->converter
->mode
= inBytes
;
144 args
->converter
->toULength
= (int8_t) i
;
149 /* Remove the accumulated high bits */
150 ch
-= offsetsFromUTF8
[inBytes
];
153 * Legal UTF-8 byte sequences in Unicode 3.0.1 and up:
154 * - use only trail bytes after a lead byte (checked above)
155 * - use the right number of trail bytes for a given lead byte
156 * - encode a code point <= U+10ffff
157 * - use the fewest possible number of bytes for their code points
158 * - use at most 4 bytes (for i>=5 it is 0x10ffff<utf8_minChar32[])
160 * Starting with Unicode 3.2, surrogate code points must not be encoded in UTF-8.
161 * There are no irregular sequences any more.
162 * In CESU-8, only surrogates, not supplementary code points, are encoded directly.
164 if (i
== inBytes
&& ch
<= MAXIMUM_UTF
&& ch
>= utf8_minChar32
[i
] &&
165 (isCESU8
? i
<= 3 : !UTF_IS_SURROGATE(ch
)))
167 /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
168 args
->converter
->toULength
= 0;
169 if (ch
<= MAXIMUM_UCS2
)
171 /* fits in 16 bits */
172 *(myTarget
++) = (UChar
) ch
;
176 /* write out the surrogates */
178 *(myTarget
++) = (UChar
) ((ch
>> HALF_SHIFT
) + SURROGATE_HIGH_START
);
179 ch
= (ch
& HALF_MASK
) + SURROGATE_LOW_START
;
180 if (myTarget
< targetLimit
)
182 *(myTarget
++) = (UChar
)ch
;
186 /* Put in overflow buffer (not handled here) */
187 args
->converter
->UCharErrorBuffer
[0] = (UChar
) ch
;
188 args
->converter
->UCharErrorBufferLength
= 1;
189 *err
= U_BUFFER_OVERFLOW_ERROR
;
196 args
->converter
->toULength
= (int8_t)i
;
197 *err
= U_ILLEGAL_CHAR_FOUND
;
204 if (mySource
< sourceLimit
&& myTarget
>= targetLimit
&& U_SUCCESS(*err
))
206 /* End of target buffer */
207 *err
= U_BUFFER_OVERFLOW_ERROR
;
210 args
->target
= myTarget
;
211 args
->source
= (const char *) mySource
;
214 static void ucnv_toUnicode_UTF8_OFFSETS_LOGIC (UConverterToUnicodeArgs
* args
,
217 const unsigned char *mySource
= (unsigned char *) args
->source
;
218 UChar
*myTarget
= args
->target
;
219 int32_t *myOffsets
= args
->offsets
;
220 int32_t offsetNum
= 0;
221 const unsigned char *sourceLimit
= (unsigned char *) args
->sourceLimit
;
222 const UChar
*targetLimit
= args
->targetLimit
;
223 unsigned char *toUBytes
= args
->converter
->toUBytes
;
224 UBool isCESU8
= (UBool
)(args
->converter
->sharedData
== &_CESU8Data
);
225 uint32_t ch
, ch2
= 0;
228 /* Restore size of current sequence */
229 if (args
->converter
->toUnicodeStatus
&& myTarget
< targetLimit
)
231 inBytes
= args
->converter
->mode
; /* restore # of bytes to consume */
232 i
= args
->converter
->toULength
; /* restore # of bytes consumed */
234 ch
= args
->converter
->toUnicodeStatus
;/*Stores the previously calculated ch from a previous call*/
235 args
->converter
->toUnicodeStatus
= 0;
239 while (mySource
< sourceLimit
&& myTarget
< targetLimit
)
242 if (ch
< 0x80) /* Simple case */
244 *(myTarget
++) = (UChar
) ch
;
245 *(myOffsets
++) = offsetNum
++;
249 toUBytes
[0] = (char)ch
;
250 inBytes
= bytesFromUTF8
[ch
];
256 if (mySource
< sourceLimit
)
258 toUBytes
[i
] = (char) (ch2
= *mySource
);
259 if (!UTF8_IS_TRAIL(ch2
))
261 break; /* i < inBytes */
263 ch
= (ch
<< 6) + ch2
;
269 args
->converter
->toUnicodeStatus
= ch
;
270 args
->converter
->mode
= inBytes
;
271 args
->converter
->toULength
= (int8_t)i
;
276 /* Remove the accumulated high bits */
277 ch
-= offsetsFromUTF8
[inBytes
];
280 * Legal UTF-8 byte sequences in Unicode 3.0.1 and up:
281 * - use only trail bytes after a lead byte (checked above)
282 * - use the right number of trail bytes for a given lead byte
283 * - encode a code point <= U+10ffff
284 * - use the fewest possible number of bytes for their code points
285 * - use at most 4 bytes (for i>=5 it is 0x10ffff<utf8_minChar32[])
287 * Starting with Unicode 3.2, surrogate code points must not be encoded in UTF-8.
288 * There are no irregular sequences any more.
289 * In CESU-8, only surrogates, not supplementary code points, are encoded directly.
291 if (i
== inBytes
&& ch
<= MAXIMUM_UTF
&& ch
>= utf8_minChar32
[i
] &&
292 (isCESU8
? i
<= 3 : !UTF_IS_SURROGATE(ch
)))
294 /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
295 args
->converter
->toULength
= 0;
296 if (ch
<= MAXIMUM_UCS2
)
298 /* fits in 16 bits */
299 *(myTarget
++) = (UChar
) ch
;
300 *(myOffsets
++) = offsetNum
;
304 /* write out the surrogates */
306 *(myTarget
++) = (UChar
) ((ch
>> HALF_SHIFT
) + SURROGATE_HIGH_START
);
307 *(myOffsets
++) = offsetNum
;
308 ch
= (ch
& HALF_MASK
) + SURROGATE_LOW_START
;
309 if (myTarget
< targetLimit
)
311 *(myTarget
++) = (UChar
)ch
;
312 *(myOffsets
++) = offsetNum
;
316 args
->converter
->UCharErrorBuffer
[0] = (UChar
) ch
;
317 args
->converter
->UCharErrorBufferLength
= 1;
318 *err
= U_BUFFER_OVERFLOW_ERROR
;
325 args
->converter
->toULength
= (int8_t)i
;
326 *err
= U_ILLEGAL_CHAR_FOUND
;
333 if (mySource
< sourceLimit
&& myTarget
>= targetLimit
&& U_SUCCESS(*err
))
334 { /* End of target buffer */
335 *err
= U_BUFFER_OVERFLOW_ERROR
;
338 args
->target
= myTarget
;
339 args
->source
= (const char *) mySource
;
340 args
->offsets
= myOffsets
;
343 U_CFUNC
void ucnv_fromUnicode_UTF8 (UConverterFromUnicodeArgs
* args
,
346 UConverter
*cnv
= args
->converter
;
347 const UChar
*mySource
= args
->source
;
348 unsigned char *myTarget
= (unsigned char *) args
->target
;
349 const UChar
*sourceLimit
= args
->sourceLimit
;
350 const unsigned char *targetLimit
= (unsigned char *) args
->targetLimit
;
351 UBool isCESU8
= (UBool
)(args
->converter
->sharedData
== &_CESU8Data
);
353 int16_t indexToWrite
;
356 if (cnv
->fromUChar32
&& myTarget
< targetLimit
)
358 ch
= cnv
->fromUChar32
;
359 cnv
->fromUChar32
= 0;
363 while (mySource
< sourceLimit
&& myTarget
< targetLimit
)
367 if (ch
< 0x80) /* Single byte */
369 *(myTarget
++) = (char) ch
;
371 else if (ch
< 0x800) /* Double byte */
373 *(myTarget
++) = (char) ((ch
>> 6) | 0xc0);
374 if (myTarget
< targetLimit
)
376 *(myTarget
++) = (char) ((ch
& 0x3f) | 0x80);
380 cnv
->charErrorBuffer
[0] = (char) ((ch
& 0x3f) | 0x80);
381 cnv
->charErrorBufferLength
= 1;
382 *err
= U_BUFFER_OVERFLOW_ERROR
;
386 /* Check for surrogates */
388 if(UTF_IS_SURROGATE(ch
) && !isCESU8
) {
389 if(UTF_IS_SURROGATE_FIRST(ch
)) {
391 if (mySource
< sourceLimit
) {
392 /* test the following code unit */
393 UChar trail
=*mySource
;
394 if(UTF_IS_SECOND_SURROGATE(trail
)) {
396 ch
=UTF16_GET_PAIR_VALUE(ch
, trail
);
398 /* convert this supplementary code point */
399 /* exit this condition tree */
401 /* this is an unmatched lead code unit (1st surrogate) */
402 /* callback(illegal) */
403 cnv
->fromUChar32
= ch
;
404 *err
= U_ILLEGAL_CHAR_FOUND
;
409 cnv
->fromUChar32
= ch
;
413 /* this is an unmatched trail code unit (2nd surrogate) */
414 /* callback(illegal) */
415 cnv
->fromUChar32
= ch
;
416 *err
= U_ILLEGAL_CHAR_FOUND
;
424 temp
[2] = (char) ((ch
>> 12) | 0xe0);
429 temp
[3] = (char) ((ch
>> 18) | 0xf0);
430 temp
[2] = (char) (((ch
>> 12) & 0x3f) | 0x80);
432 temp
[1] = (char) (((ch
>> 6) & 0x3f) | 0x80);
433 temp
[0] = (char) ((ch
& 0x3f) | 0x80);
435 for (; indexToWrite
>= 0; indexToWrite
--)
437 if (myTarget
< targetLimit
)
439 *(myTarget
++) = temp
[indexToWrite
];
443 cnv
->charErrorBuffer
[cnv
->charErrorBufferLength
++] = temp
[indexToWrite
];
444 *err
= U_BUFFER_OVERFLOW_ERROR
;
450 if (mySource
< sourceLimit
&& myTarget
>= targetLimit
&& U_SUCCESS(*err
))
452 *err
= U_BUFFER_OVERFLOW_ERROR
;
455 args
->target
= (char *) myTarget
;
456 args
->source
= mySource
;
459 U_CFUNC
void ucnv_fromUnicode_UTF8_OFFSETS_LOGIC (UConverterFromUnicodeArgs
* args
,
462 UConverter
*cnv
= args
->converter
;
463 const UChar
*mySource
= args
->source
;
464 unsigned char *myTarget
= (unsigned char *) args
->target
;
465 int32_t *myOffsets
= args
->offsets
;
466 const UChar
*sourceLimit
= args
->sourceLimit
;
467 const unsigned char *targetLimit
= (unsigned char *) args
->targetLimit
;
468 UBool isCESU8
= (UBool
)(args
->converter
->sharedData
== &_CESU8Data
);
470 int32_t offsetNum
, nextSourceIndex
;
471 int16_t indexToWrite
;
474 if (cnv
->fromUChar32
&& myTarget
< targetLimit
)
476 ch
= cnv
->fromUChar32
;
477 cnv
->fromUChar32
= 0;
485 while (mySource
< sourceLimit
&& myTarget
< targetLimit
)
489 if (ch
< 0x80) /* Single byte */
491 *(myOffsets
++) = offsetNum
++;
492 *(myTarget
++) = (char) ch
;
494 else if (ch
< 0x800) /* Double byte */
496 *(myOffsets
++) = offsetNum
;
497 *(myTarget
++) = (char) ((ch
>> 6) | 0xc0);
498 if (myTarget
< targetLimit
)
500 *(myOffsets
++) = offsetNum
++;
501 *(myTarget
++) = (char) ((ch
& 0x3f) | 0x80);
505 cnv
->charErrorBuffer
[0] = (char) ((ch
& 0x3f) | 0x80);
506 cnv
->charErrorBufferLength
= 1;
507 *err
= U_BUFFER_OVERFLOW_ERROR
;
511 /* Check for surrogates */
513 nextSourceIndex
= offsetNum
+ 1;
515 if(UTF_IS_SURROGATE(ch
) && !isCESU8
) {
516 if(UTF_IS_SURROGATE_FIRST(ch
)) {
518 if (mySource
< sourceLimit
) {
519 /* test the following code unit */
520 UChar trail
=*mySource
;
521 if(UTF_IS_SECOND_SURROGATE(trail
)) {
524 ch
=UTF16_GET_PAIR_VALUE(ch
, trail
);
526 /* convert this supplementary code point */
527 /* exit this condition tree */
529 /* this is an unmatched lead code unit (1st surrogate) */
530 /* callback(illegal) */
531 cnv
->fromUChar32
= ch
;
532 *err
= U_ILLEGAL_CHAR_FOUND
;
537 cnv
->fromUChar32
= ch
;
541 /* this is an unmatched trail code unit (2nd surrogate) */
542 /* callback(illegal) */
543 cnv
->fromUChar32
= ch
;
544 *err
= U_ILLEGAL_CHAR_FOUND
;
552 temp
[2] = (char) ((ch
>> 12) | 0xe0);
557 temp
[3] = (char) ((ch
>> 18) | 0xf0);
558 temp
[2] = (char) (((ch
>> 12) & 0x3f) | 0x80);
560 temp
[1] = (char) (((ch
>> 6) & 0x3f) | 0x80);
561 temp
[0] = (char) ((ch
& 0x3f) | 0x80);
563 for (; indexToWrite
>= 0; indexToWrite
--)
565 if (myTarget
< targetLimit
)
567 *(myOffsets
++) = offsetNum
;
568 *(myTarget
++) = temp
[indexToWrite
];
572 cnv
->charErrorBuffer
[cnv
->charErrorBufferLength
++] = temp
[indexToWrite
];
573 *err
= U_BUFFER_OVERFLOW_ERROR
;
576 offsetNum
= nextSourceIndex
;
580 if (mySource
< sourceLimit
&& myTarget
>= targetLimit
&& U_SUCCESS(*err
))
582 *err
= U_BUFFER_OVERFLOW_ERROR
;
585 args
->target
= (char *) myTarget
;
586 args
->source
= mySource
;
587 args
->offsets
= myOffsets
;
590 static UChar32
ucnv_getNextUChar_UTF8(UConverterToUnicodeArgs
*args
,
593 const uint8_t *sourceInitial
;
594 const uint8_t *source
;
595 uint16_t extraBytesToWrite
;
598 int8_t i
, isLegalSequence
;
600 /* UTF-8 only here, the framework handles CESU-8 to combine surrogate pairs */
602 cnv
= args
->converter
;
603 sourceInitial
= source
= (const uint8_t *)args
->source
;
604 if (source
>= (const uint8_t *)args
->sourceLimit
)
607 *err
= U_INDEX_OUTOFBOUNDS_ERROR
;
611 myByte
= (uint8_t)*(source
++);
614 args
->source
= (const char *)source
;
615 return (UChar32
)myByte
;
618 extraBytesToWrite
= (uint16_t)bytesFromUTF8
[myByte
];
619 if (extraBytesToWrite
== 0) {
620 cnv
->toUBytes
[0] = myByte
;
622 *err
= U_ILLEGAL_CHAR_FOUND
;
623 args
->source
= (const char *)source
;
627 /*The byte sequence is longer than the buffer area passed*/
628 if (((const char *)source
+ extraBytesToWrite
- 1) > args
->sourceLimit
)
630 /* check if all of the remaining bytes are trail bytes */
631 cnv
->toUBytes
[0] = myByte
;
633 *err
= U_TRUNCATED_CHAR_FOUND
;
634 while(source
< (const uint8_t *)args
->sourceLimit
) {
635 if(U8_IS_TRAIL(myByte
= *source
)) {
636 cnv
->toUBytes
[i
++] = myByte
;
639 /* error even before we run out of input */
640 *err
= U_ILLEGAL_CHAR_FOUND
;
645 args
->source
= (const char *)source
;
651 switch(extraBytesToWrite
)
653 /* note: code falls through cases! (sic)*/
655 ch
+= (myByte
= *source
);
657 if (!UTF8_IS_TRAIL(myByte
))
664 ch
+= (myByte
= *source
);
666 if (!UTF8_IS_TRAIL(myByte
))
673 ch
+= (myByte
= *source
);
675 if (!UTF8_IS_TRAIL(myByte
))
682 ch
+= (myByte
= *source
);
684 if (!UTF8_IS_TRAIL(myByte
))
691 ch
+= (myByte
= *source
);
692 if (!UTF8_IS_TRAIL(myByte
))
699 ch
-= offsetsFromUTF8
[extraBytesToWrite
];
700 args
->source
= (const char *)source
;
703 * Legal UTF-8 byte sequences in Unicode 3.0.1 and up:
704 * - use only trail bytes after a lead byte (checked above)
705 * - use the right number of trail bytes for a given lead byte
706 * - encode a code point <= U+10ffff
707 * - use the fewest possible number of bytes for their code points
708 * - use at most 4 bytes (for i>=5 it is 0x10ffff<utf8_minChar32[])
710 * Starting with Unicode 3.2, surrogate code points must not be encoded in UTF-8.
711 * There are no irregular sequences any more.
713 if (isLegalSequence
&&
714 (uint32_t)ch
<= MAXIMUM_UTF
&&
715 (uint32_t)ch
>= utf8_minChar32
[extraBytesToWrite
] &&
718 return ch
; /* return the code point */
721 for(i
= 0; sourceInitial
< source
; ++i
) {
722 cnv
->toUBytes
[i
] = *sourceInitial
++;
725 *err
= U_ILLEGAL_CHAR_FOUND
;
729 /* UTF-8 converter data ----------------------------------------------------- */
731 static const UConverterImpl _UTF8Impl
={
742 ucnv_toUnicode_UTF8_OFFSETS_LOGIC
,
743 ucnv_fromUnicode_UTF8
,
744 ucnv_fromUnicode_UTF8_OFFSETS_LOGIC
,
745 ucnv_getNextUChar_UTF8
,
751 ucnv_getNonSurrogateUnicodeSet
754 /* The 1208 CCSID refers to any version of Unicode of UTF-8 */
755 static const UConverterStaticData _UTF8StaticData
={
756 sizeof(UConverterStaticData
),
758 1208, UCNV_IBM
, UCNV_UTF8
,
759 1, 3, /* max 3 bytes per UChar from UTF-8 (4 bytes from surrogate _pair_) */
760 { 0xef, 0xbf, 0xbd, 0 },3,FALSE
,FALSE
,
763 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
767 const UConverterSharedData _UTF8Data
={
768 sizeof(UConverterSharedData
), ~((uint32_t) 0),
769 NULL
, NULL
, &_UTF8StaticData
, FALSE
, &_UTF8Impl
,
773 /* CESU-8 converter data ---------------------------------------------------- */
775 static const UConverterImpl _CESU8Impl
={
786 ucnv_toUnicode_UTF8_OFFSETS_LOGIC
,
787 ucnv_fromUnicode_UTF8
,
788 ucnv_fromUnicode_UTF8_OFFSETS_LOGIC
,
795 ucnv_getCompleteUnicodeSet
798 static const UConverterStaticData _CESU8StaticData
={
799 sizeof(UConverterStaticData
),
801 0, UCNV_UNKNOWN
, UCNV_CESU8
, 1, 3,
802 { 0xef, 0xbf, 0xbd, 0 },3,FALSE
,FALSE
,
805 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
809 const UConverterSharedData _CESU8Data
={
810 sizeof(UConverterSharedData
), ~((uint32_t) 0),
811 NULL
, NULL
, &_CESU8StaticData
, FALSE
, &_CESU8Impl
,