ICU 69.1 69.1

ucnv.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 **********************************************************************
5 * Copyright (C) 1999-2014, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
8 * ucnv.h:
9 * External APIs for the ICU's codeset conversion library
10 * Bertrand A. Damiba
11 *
12 * Modification History:
13 *
14 * Date Name Description
15 * 04/04/99 helena Fixed internal header inclusion.
16 * 05/11/00 helena Added setFallback and usesFallback APIs.
17 * 06/29/2000 helena Major rewrite of the callback APIs.
18 * 12/07/2000 srl Update of documentation
19 */
20
49 #ifndef UCNV_H
50 #define UCNV_H
51
52 #include "unicode/ucnv_err.h"
53 #include "unicode/uenum.h"
54
55 #if U_SHOW_CPLUSPLUS_API
56 #include "unicode/localpointer.h"
57 #endif // U_SHOW_CPLUSPLUS_API
58
59 #if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN)
60
61 #define USET_DEFINED
62
71 typedef struct USet USet;
72
73 #endif
74
75 #if !UCONFIG_NO_CONVERSION
76
77 U_CDECL_BEGIN
78
80 #define UCNV_MAX_CONVERTER_NAME_LENGTH 60
81
82 #define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
83
85 #define UCNV_SI 0x0F
86
87 #define UCNV_SO 0x0E
88
94 typedef enum {
96 UCNV_UNSUPPORTED_CONVERTER = -1,
98 UCNV_SBCS = 0,
100 UCNV_DBCS = 1,
102 UCNV_MBCS = 2,
104 UCNV_LATIN_1 = 3,
106 UCNV_UTF8 = 4,
108 UCNV_UTF16_BigEndian = 5,
110 UCNV_UTF16_LittleEndian = 6,
112 UCNV_UTF32_BigEndian = 7,
114 UCNV_UTF32_LittleEndian = 8,
116 UCNV_EBCDIC_STATEFUL = 9,
118 UCNV_ISO_2022 = 10,
119
121 UCNV_LMBCS_1 = 11,
123 UCNV_LMBCS_2,
125 UCNV_LMBCS_3,
127 UCNV_LMBCS_4,
129 UCNV_LMBCS_5,
131 UCNV_LMBCS_6,
133 UCNV_LMBCS_8,
135 UCNV_LMBCS_11,
137 UCNV_LMBCS_16,
139 UCNV_LMBCS_17,
141 UCNV_LMBCS_18,
143 UCNV_LMBCS_19,
145 UCNV_LMBCS_LAST = UCNV_LMBCS_19,
147 UCNV_HZ,
149 UCNV_SCSU,
151 UCNV_ISCII,
153 UCNV_US_ASCII,
155 UCNV_UTF7,
157 UCNV_BOCU1,
159 UCNV_UTF16,
161 UCNV_UTF32,
163 UCNV_CESU8,
165 UCNV_IMAP_MAILBOX,
167 UCNV_COMPOUND_TEXT,
168
169 /* Number of converter types for which we have conversion routines. */
170 UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
171 } UConverterType;
172
182 typedef enum {
183 UCNV_UNKNOWN = -1,
184 UCNV_IBM = 0
185 } UConverterPlatform;
186
202 typedef void (U_EXPORT2 *UConverterToUCallback) (
203 const void* context,
204 UConverterToUnicodeArgs *args,
205 const char *codeUnits,
206 int32_t length,
207 UConverterCallbackReason reason,
208 UErrorCode *pErrorCode);
209
225 typedef void (U_EXPORT2 *UConverterFromUCallback) (
226 const void* context,
227 UConverterFromUnicodeArgs *args,
228 const UChar* codeUnits,
229 int32_t length,
230 UChar32 codePoint,
231 UConverterCallbackReason reason,
232 UErrorCode *pErrorCode);
233
234 U_CDECL_END
235
241 #define UCNV_OPTION_SEP_CHAR ','
242
248 #define UCNV_OPTION_SEP_STRING ","
249
255 #define UCNV_VALUE_SEP_CHAR '='
256
262 #define UCNV_VALUE_SEP_STRING "="
263
272 #define UCNV_LOCALE_OPTION_STRING ",locale="
273
285 #define UCNV_VERSION_OPTION_STRING ",version="
286
297 #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
298
314 U_CAPI int U_EXPORT2
315 ucnv_compareNames(const char *name1, const char *name2);
316
317
368 U_CAPI UConverter* U_EXPORT2
369 ucnv_open(const char *converterName, UErrorCode *err);
370
371
398 U_CAPI UConverter* U_EXPORT2
399 ucnv_openU(const UChar *name,
400 UErrorCode *err);
401
466 U_CAPI UConverter* U_EXPORT2
467 ucnv_openCCSID(int32_t codepage,
468 UConverterPlatform platform,
469 UErrorCode * err);
470
501 U_CAPI UConverter* U_EXPORT2
502 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
503
543 U_CAPI UConverter * U_EXPORT2
544 ucnv_safeClone(const UConverter *cnv,
545 void *stackBuffer,
546 int32_t *pBufferSize,
547 UErrorCode *status);
548
549 #ifndef U_HIDE_DEPRECATED_API
550
557 #define U_CNV_SAFECLONE_BUFFERSIZE 1024
558
559 #endif /* U_HIDE_DEPRECATED_API */
560
572 U_CAPI void U_EXPORT2
573 ucnv_close(UConverter * converter);
574
575 #if U_SHOW_CPLUSPLUS_API
576
577 U_NAMESPACE_BEGIN
578
588 U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close);
589
590 U_NAMESPACE_END
591
592 #endif
593
611 U_CAPI void U_EXPORT2
612 ucnv_getSubstChars(const UConverter *converter,
613 char *subChars,
614 int8_t *len,
615 UErrorCode *err);
616
636 U_CAPI void U_EXPORT2
637 ucnv_setSubstChars(UConverter *converter,
638 const char *subChars,
639 int8_t len,
640 UErrorCode *err);
641
669 U_CAPI void U_EXPORT2
670 ucnv_setSubstString(UConverter *cnv,
671 const UChar *s,
672 int32_t length,
673 UErrorCode *err);
674
688 U_CAPI void U_EXPORT2
689 ucnv_getInvalidChars(const UConverter *converter,
690 char *errBytes,
691 int8_t *len,
692 UErrorCode *err);
693
707 U_CAPI void U_EXPORT2
708 ucnv_getInvalidUChars(const UConverter *converter,
709 UChar *errUChars,
710 int8_t *len,
711 UErrorCode *err);
712
720 U_CAPI void U_EXPORT2
721 ucnv_reset(UConverter *converter);
722
731 U_CAPI void U_EXPORT2
732 ucnv_resetToUnicode(UConverter *converter);
733
742 U_CAPI void U_EXPORT2
743 ucnv_resetFromUnicode(UConverter *converter);
744
795 U_CAPI int8_t U_EXPORT2
796 ucnv_getMaxCharSize(const UConverter *converter);
797
817 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
818 (((int32_t)(length)+10)*(int32_t)(maxCharSize))
819
828 U_CAPI int8_t U_EXPORT2
829 ucnv_getMinCharSize(const UConverter *converter);
830
845 U_CAPI int32_t U_EXPORT2
846 ucnv_getDisplayName(const UConverter *converter,
847 const char *displayLocale,
848 UChar *displayName,
849 int32_t displayNameCapacity,
850 UErrorCode *err);
851
862 U_CAPI const char * U_EXPORT2
863 ucnv_getName(const UConverter *converter, UErrorCode *err);
864
888 U_CAPI int32_t U_EXPORT2
889 ucnv_getCCSID(const UConverter *converter,
890 UErrorCode *err);
891
902 U_CAPI UConverterPlatform U_EXPORT2
903 ucnv_getPlatform(const UConverter *converter,
904 UErrorCode *err);
905
914 U_CAPI UConverterType U_EXPORT2
915 ucnv_getType(const UConverter * converter);
916
932 U_CAPI void U_EXPORT2
933 ucnv_getStarters(const UConverter* converter,
934 UBool starters[256],
935 UErrorCode* err);
936
937
943 typedef enum UConverterUnicodeSet {
945 UCNV_ROUNDTRIP_SET,
947 UCNV_ROUNDTRIP_AND_FALLBACK_SET,
948 #ifndef U_HIDE_DEPRECATED_API
949
953 UCNV_SET_COUNT
954 #endif // U_HIDE_DEPRECATED_API
955 } UConverterUnicodeSet;
956
957
1003 U_CAPI void U_EXPORT2
1004 ucnv_getUnicodeSet(const UConverter *cnv,
1005 USet *setFillIn,
1006 UConverterUnicodeSet whichSet,
1007 UErrorCode *pErrorCode);
1008
1020 U_CAPI void U_EXPORT2
1021 ucnv_getToUCallBack (const UConverter * converter,
1022 UConverterToUCallback *action,
1023 const void **context);
1024
1036 U_CAPI void U_EXPORT2
1037 ucnv_getFromUCallBack (const UConverter * converter,
1038 UConverterFromUCallback *action,
1039 const void **context);
1040
1056 U_CAPI void U_EXPORT2
1057 ucnv_setToUCallBack (UConverter * converter,
1058 UConverterToUCallback newAction,
1059 const void* newContext,
1060 UConverterToUCallback *oldAction,
1061 const void** oldContext,
1062 UErrorCode * err);
1063
1079 U_CAPI void U_EXPORT2
1080 ucnv_setFromUCallBack (UConverter * converter,
1081 UConverterFromUCallback newAction,
1082 const void *newContext,
1083 UConverterFromUCallback *oldAction,
1084 const void **oldContext,
1085 UErrorCode * err);
1086
1145 U_CAPI void U_EXPORT2
1146 ucnv_fromUnicode (UConverter * converter,
1147 char **target,
1148 const char *targetLimit,
1149 const UChar ** source,
1150 const UChar * sourceLimit,
1151 int32_t* offsets,
1152 UBool flush,
1153 UErrorCode * err);
1154
1214 U_CAPI void U_EXPORT2
1215 ucnv_toUnicode(UConverter *converter,
1216 UChar **target,
1217 const UChar *targetLimit,
1218 const char **source,
1219 const char *sourceLimit,
1220 int32_t *offsets,
1221 UBool flush,
1222 UErrorCode *err);
1223
1251 U_CAPI int32_t U_EXPORT2
1252 ucnv_fromUChars(UConverter *cnv,
1253 char *dest, int32_t destCapacity,
1254 const UChar *src, int32_t srcLength,
1255 UErrorCode *pErrorCode);
1256
1283 U_CAPI int32_t U_EXPORT2
1284 ucnv_toUChars(UConverter *cnv,
1285 UChar *dest, int32_t destCapacity,
1286 const char *src, int32_t srcLength,
1287 UErrorCode *pErrorCode);
1288
1359 U_CAPI UChar32 U_EXPORT2
1360 ucnv_getNextUChar(UConverter * converter,
1361 const char **source,
1362 const char * sourceLimit,
1363 UErrorCode * err);
1364
1503 U_CAPI void U_EXPORT2
1504 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
1505 char **target, const char *targetLimit,
1506 const char **source, const char *sourceLimit,
1507 UChar *pivotStart, UChar **pivotSource,
1508 UChar **pivotTarget, const UChar *pivotLimit,
1509 UBool reset, UBool flush,
1510 UErrorCode *pErrorCode);
1511
1567 U_CAPI int32_t U_EXPORT2
1568 ucnv_convert(const char *toConverterName,
1569 const char *fromConverterName,
1570 char *target,
1571 int32_t targetCapacity,
1572 const char *source,
1573 int32_t sourceLength,
1574 UErrorCode *pErrorCode);
1575
1621 U_CAPI int32_t U_EXPORT2
1622 ucnv_toAlgorithmic(UConverterType algorithmicType,
1623 UConverter *cnv,
1624 char *target, int32_t targetCapacity,
1625 const char *source, int32_t sourceLength,
1626 UErrorCode *pErrorCode);
1627
1673 U_CAPI int32_t U_EXPORT2
1674 ucnv_fromAlgorithmic(UConverter *cnv,
1675 UConverterType algorithmicType,
1676 char *target, int32_t targetCapacity,
1677 const char *source, int32_t sourceLength,
1678 UErrorCode *pErrorCode);
1679
1687 U_CAPI int32_t U_EXPORT2
1688 ucnv_flushCache(void);
1689
1697 U_CAPI int32_t U_EXPORT2
1698 ucnv_countAvailable(void);
1699
1710 U_CAPI const char* U_EXPORT2
1711 ucnv_getAvailableName(int32_t n);
1712
1725 U_CAPI UEnumeration * U_EXPORT2
1726 ucnv_openAllNames(UErrorCode *pErrorCode);
1727
1738 U_CAPI uint16_t U_EXPORT2
1739 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
1740
1753 U_CAPI const char * U_EXPORT2
1754 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
1755
1769 U_CAPI void U_EXPORT2
1770 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
1771
1795 U_CAPI UEnumeration * U_EXPORT2
1796 ucnv_openStandardNames(const char *convName,
1797 const char *standard,
1798 UErrorCode *pErrorCode);
1799
1805 U_CAPI uint16_t U_EXPORT2
1806 ucnv_countStandards(void);
1807
1815 U_CAPI const char * U_EXPORT2
1816 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
1817
1837 U_CAPI const char * U_EXPORT2
1838 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
1839
1859 U_CAPI const char * U_EXPORT2
1860 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
1861
1876 U_CAPI const char * U_EXPORT2
1877 ucnv_getDefaultName(void);
1878
1879 #ifndef U_HIDE_SYSTEM_API
1880
1896 U_CAPI void U_EXPORT2
1897 ucnv_setDefaultName(const char *name);
1898 #endif /* U_HIDE_SYSTEM_API */
1899
1917 U_CAPI void U_EXPORT2
1918 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
1919
1928 U_CAPI UBool U_EXPORT2
1929 ucnv_isAmbiguous(const UConverter *cnv);
1930
1946 U_CAPI void U_EXPORT2
1947 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
1948
1958 U_CAPI UBool U_EXPORT2
1959 ucnv_usesFallback(const UConverter *cnv);
1960
1990 U_CAPI const char* U_EXPORT2
1991 ucnv_detectUnicodeSignature(const char* source,
1992 int32_t sourceLength,
1993 int32_t *signatureLength,
1994 UErrorCode *pErrorCode);
1995
2007 U_CAPI int32_t U_EXPORT2
2008 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
2009
2021 U_CAPI int32_t U_EXPORT2
2022 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
2023
2039 U_CAPI UBool U_EXPORT2
2040 ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status);
2041
2042 #endif
2043
2044 #endif
2045 /*_UCNV*/
UCNV_LMBCS_1
@ UCNV_LMBCS_1
Definition: ucnv.h:121
ucnv_getAlias
const U_CAPI char * ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode)
Gives the name of the alias at given index of alias list.
ucnv_getNextUChar
U_CAPI UChar32 ucnv_getNextUChar(UConverter *converter, const char **source, const char *sourceLimit, UErrorCode *err)
Convert a codepage buffer into Unicode one character at a time.
UConverterToUnicodeArgs
The structure for the toUnicode callback function parameter.
Definition: ucnv_err.h:210
UCNV_SET_COUNT
@ UCNV_SET_COUNT
Number of UConverterUnicodeSet selectors.
Definition: ucnv.h:953
UConverterCallbackReason
UConverterCallbackReason
The process condition code to be used with the callbacks.
Definition: ucnv_err.h:157
ucnv_openAllNames
U_CAPI UEnumeration * ucnv_openAllNames(UErrorCode *pErrorCode)
Returns a UEnumeration to enumerate all of the canonical converter names, as per the alias file,...
UCNV_UTF7
@ UCNV_UTF7
Definition: ucnv.h:155
ucnv_flushCache
U_CAPI int32_t ucnv_flushCache(void)
Frees up memory occupied by unused, cached converter shared data.
ucnv_safeClone
U_CAPI UConverter * ucnv_safeClone(const UConverter *cnv, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status)
Thread safe converter cloning operation.
ucnv_setFromUCallBack
U_CAPI void ucnv_setFromUCallBack(UConverter *converter, UConverterFromUCallback newAction, const void *newContext, UConverterFromUCallback *oldAction, const void **oldContext, UErrorCode *err)
Changes the current callback function used by the converter when an illegal or invalid sequence is fo...
ucnv_openU
U_CAPI UConverter * ucnv_openU(const UChar *name, UErrorCode *err)
Creates a Unicode converter with the names specified as unicode string.
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
UCNV_ISCII
@ UCNV_ISCII
Definition: ucnv.h:151
ucnv_getInvalidUChars
U_CAPI void ucnv_getInvalidUChars(const UConverter *converter, UChar *errUChars, int8_t *len, UErrorCode *err)
Fills in the output parameter, errChars, with the error characters from the last failing conversion.
ucnv_err.h
C UConverter predefined error callbacks.
ucnv_countAvailable
U_CAPI int32_t ucnv_countAvailable(void)
Returns the number of available converters, as per the alias file.
UCNV_LMBCS_18
@ UCNV_LMBCS_18
Definition: ucnv.h:141
ucnv_getStarters
U_CAPI void ucnv_getStarters(const UConverter *converter, UBool starters[256], UErrorCode *err)
Gets the "starter" (lead) bytes for converters of type MBCS.
ucnv_getToUCallBack
U_CAPI void ucnv_getToUCallBack(const UConverter *converter, UConverterToUCallback *action, const void **context)
Gets the current calback function used by the converter when an illegal or invalid codepage sequence ...
ucnv_getCCSID
U_CAPI int32_t ucnv_getCCSID(const UConverter *converter, UErrorCode *err)
Gets a codepage number associated with the converter.
ucnv_getPlatform
U_CAPI UConverterPlatform ucnv_getPlatform(const UConverter *converter, UErrorCode *err)
Gets a codepage platform associated with the converter.
UCNV_UTF16_BigEndian
@ UCNV_UTF16_BigEndian
Definition: ucnv.h:108
UCNV_MBCS
@ UCNV_MBCS
Definition: ucnv.h:102
ucnv_getMinCharSize
U_CAPI int8_t ucnv_getMinCharSize(const UConverter *converter)
Returns the minimum byte length (per codepoint) for characters in this codepage.
ucnv_convertEx
U_CAPI void ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv, char **target, const char *targetLimit, const char **source, const char *sourceLimit, UChar *pivotStart, UChar **pivotSource, UChar **pivotTarget, const UChar *pivotLimit, UBool reset, UBool flush, UErrorCode *pErrorCode)
Convert from one external charset to another using two existing UConverters.
ucnv_getMaxCharSize
U_CAPI int8_t ucnv_getMaxCharSize(const UConverter *converter)
Returns the maximum number of bytes that are output per UChar in conversion from Unicode using this c...
ucnv_setFallback
U_CAPI void ucnv_setFallback(UConverter *cnv, UBool usesFallback)
Sets the converter to use fallback mappings or not.
ucnv_getDisplayName
U_CAPI int32_t ucnv_getDisplayName(const UConverter *converter, const char *displayLocale, UChar *displayName, int32_t displayNameCapacity, UErrorCode *err)
Returns the display name of the converter passed in based on the Locale passed in.
UCNV_COMPOUND_TEXT
@ UCNV_COMPOUND_TEXT
Definition: ucnv.h:167
UCNV_EBCDIC_STATEFUL
@ UCNV_EBCDIC_STATEFUL
Definition: ucnv.h:116
ucnv_getFromUCallBack
U_CAPI void ucnv_getFromUCallBack(const UConverter *converter, UConverterFromUCallback *action, const void **context)
Gets the current callback function used by the converter when illegal or invalid Unicode sequence is ...
ucnv_countAliases
U_CAPI uint16_t ucnv_countAliases(const char *alias, UErrorCode *pErrorCode)
Gives the number of aliases for a given converter or alias name.
ucnv_getInvalidChars
U_CAPI void ucnv_getInvalidChars(const UConverter *converter, char *errBytes, int8_t *len, UErrorCode *err)
Fills in the output parameter, errBytes, with the error characters from the last failing conversion.
ucnv_getSubstChars
U_CAPI void ucnv_getSubstChars(const UConverter *converter, char *subChars, int8_t *len, UErrorCode *err)
Fills in the output parameter, subChars, with the substitution characters as multiple bytes.
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:467
ucnv_isFixedWidth
U_CAPI UBool ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status)
Returns whether or not the charset of the converter has a fixed number of bytes per charset character...
ucnv_toAlgorithmic
U_CAPI int32_t ucnv_toAlgorithmic(UConverterType algorithmicType, UConverter *cnv, char *target, int32_t targetCapacity, const char *source, int32_t sourceLength, UErrorCode *pErrorCode)
Convert from one external charset to another.
ucnv_setDefaultName
U_CAPI void ucnv_setDefaultName(const char *name)
This function is not thread safe.
ucnv_resetFromUnicode
U_CAPI void ucnv_resetFromUnicode(UConverter *converter)
Resets the from-Unicode part of a converter state to the default state.
ucnv_fromUCountPending
U_CAPI int32_t ucnv_fromUCountPending(const UConverter *cnv, UErrorCode *status)
Returns the number of UChars held in the converter's internal state because more input is needed for ...
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
UCNV_CESU8
@ UCNV_CESU8
Definition: ucnv.h:163
UConverterFromUnicodeArgs
The structure for the fromUnicode callback function parameter.
Definition: ucnv_err.h:194
UCNV_UTF8
@ UCNV_UTF8
Definition: ucnv.h:106
ucnv_toUCountPending
U_CAPI int32_t ucnv_toUCountPending(const UConverter *cnv, UErrorCode *status)
Returns the number of chars held in the converter's internal state because more input is needed for c...
UCNV_UTF16_LittleEndian
@ UCNV_UTF16_LittleEndian
Definition: ucnv.h:110
ucnv_fromUnicode
U_CAPI void ucnv_fromUnicode(UConverter *converter, char **target, const char *targetLimit, const UChar **source, const UChar *sourceLimit, int32_t *offsets, UBool flush, UErrorCode *err)
Converts an array of unicode characters to an array of codepage characters.
UCNV_UTF32_BigEndian
@ UCNV_UTF32_BigEndian
Definition: ucnv.h:112
ucnv_openPackage
U_CAPI UConverter * ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err)
UCNV_SCSU
@ UCNV_SCSU
Definition: ucnv.h:149
U_CDECL_END
#define U_CDECL_END
Definition: umachine.h:86
UCNV_LMBCS_16
@ UCNV_LMBCS_16
Definition: ucnv.h:137
U_CDECL_BEGIN
#define U_CDECL_BEGIN
Definition: umachine.h:85
ucnv_fixFileSeparator
U_CAPI void ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen)
Fixes the backslash character mismapping.
UConverterPlatform
UConverterPlatform
Enum for specifying which platform a converter ID refers to.
Definition: ucnv.h:182
ucnv_getAvailableName
const U_CAPI char * ucnv_getAvailableName(int32_t n)
Gets the canonical converter name of the specified converter from a list of all available converters ...
UConverterType
UConverterType
Enum for specifying basic types of converters.
Definition: ucnv.h:94
ucnv_getType
U_CAPI UConverterType ucnv_getType(const UConverter *converter)
Gets the type of the converter e.g.
UCNV_US_ASCII
@ UCNV_US_ASCII
Definition: ucnv.h:153
UConverterToUCallback
void(* UConverterToUCallback)(const void *context, UConverterToUnicodeArgs *args, const char *codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode *pErrorCode)
Function pointer for error callback in the codepage to unicode direction.
Definition: ucnv.h:202
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
Definition: localpointer.h:550
ucnv_getUnicodeSet
U_CAPI void ucnv_getUnicodeSet(const UConverter *cnv, USet *setFillIn, UConverterUnicodeSet whichSet, UErrorCode *pErrorCode)
Returns the set of Unicode code points that can be converted by an ICU converter.
ucnv_getStandardName
const U_CAPI char * ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode)
Returns a standard name for a given converter name.
ucnv_resetToUnicode
U_CAPI void ucnv_resetToUnicode(UConverter *converter)
Resets the to-Unicode part of a converter state to the default state.
ucnv_toUnicode
U_CAPI void ucnv_toUnicode(UConverter *converter, UChar **target, const UChar *targetLimit, const char **source, const char *sourceLimit, int32_t *offsets, UBool flush, UErrorCode *err)
Converts a buffer of codepage bytes into an array of unicode UChars characters.
UCNV_LMBCS_3
@ UCNV_LMBCS_3
Definition: ucnv.h:125
ucnv_getDefaultName
const U_CAPI char * ucnv_getDefaultName(void)
Returns the current default converter name.
ucnv_setSubstChars
U_CAPI void ucnv_setSubstChars(UConverter *converter, const char *subChars, int8_t len, UErrorCode *err)
Sets the substitution chars when converting from unicode to a codepage.
ucnv_getAliases
U_CAPI void ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode)
Fill-up the list of alias names for the given alias.
ucnv_compareNames
U_CAPI int ucnv_compareNames(const char *name1, const char *name2)
Do a fuzzy compare of two converter/alias names.
ucnv_fromAlgorithmic
U_CAPI int32_t ucnv_fromAlgorithmic(UConverter *cnv, UConverterType algorithmicType, char *target, int32_t targetCapacity, const char *source, int32_t sourceLength, UErrorCode *pErrorCode)
Convert from one external charset to another.
ucnv_setToUCallBack
U_CAPI void ucnv_setToUCallBack(UConverter *converter, UConverterToUCallback newAction, const void *newContext, UConverterToUCallback *oldAction, const void **oldContext, UErrorCode *err)
Changes the callback function used by the converter when an illegal or invalid sequence is found.
UCNV_IMAP_MAILBOX
@ UCNV_IMAP_MAILBOX
Definition: ucnv.h:165
ucnv_openStandardNames
U_CAPI UEnumeration * ucnv_openStandardNames(const char *convName, const char *standard, UErrorCode *pErrorCode)
Return a new UEnumeration object for enumerating all the alias names for a given converter that are r...
UCNV_LMBCS_19
@ UCNV_LMBCS_19
Definition: ucnv.h:143
ucnv_openCCSID
U_CAPI UConverter * ucnv_openCCSID(int32_t codepage, UConverterPlatform platform, UErrorCode *err)
Creates a UConverter object from a CCSID number and platform pair.
UCNV_DBCS
@ UCNV_DBCS
Definition: ucnv.h:100
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
UConverterFromUCallback
void(* UConverterFromUCallback)(const void *context, UConverterFromUnicodeArgs *args, const UChar *codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode *pErrorCode)
Function pointer for error callback in the unicode to codepage direction.
Definition: ucnv.h:225
UConverterUnicodeSet
UConverterUnicodeSet
Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet().
Definition: ucnv.h:943
UCNV_UTF16
@ UCNV_UTF16
Definition: ucnv.h:159
ucnv_getName
const U_CAPI char * ucnv_getName(const UConverter *converter, UErrorCode *err)
Gets the internal, canonical name of the converter (zero-terminated).
UCNV_HZ
@ UCNV_HZ
Definition: ucnv.h:147
ucnv_convert
U_CAPI int32_t ucnv_convert(const char *toConverterName, const char *fromConverterName, char *target, int32_t targetCapacity, const char *source, int32_t sourceLength, UErrorCode *pErrorCode)
Convert from one external charset to another.
ucnv_isAmbiguous
U_CAPI UBool ucnv_isAmbiguous(const UConverter *cnv)
Determines if the converter contains ambiguous mappings of the same character or not.
UConverter
struct UConverter UConverter
Definition: ucnv_err.h:96
UCNV_UNSUPPORTED_CONVERTER
@ UCNV_UNSUPPORTED_CONVERTER
Definition: ucnv.h:96
ucnv_fromUChars
U_CAPI int32_t ucnv_fromUChars(UConverter *cnv, char *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode)
Convert the Unicode string into a codepage string using an existing UConverter.
UChar
char16_t UChar
Definition: umachine.h:418
ucnv_detectUnicodeSignature
const U_CAPI char * ucnv_detectUnicodeSignature(const char *source, int32_t sourceLength, int32_t *signatureLength, UErrorCode *pErrorCode)
Detects Unicode signature byte sequences at the start of the byte stream and returns the charset name...
UCNV_LMBCS_LAST
@ UCNV_LMBCS_LAST
Definition: ucnv.h:145
ucnv_getStandard
const U_CAPI char * ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode)
Gives the name of the standard at given index of standard list.
UCNV_ISO_2022
@ UCNV_ISO_2022
Definition: ucnv.h:118
ucnv_reset
U_CAPI void ucnv_reset(UConverter *converter)
Resets the state of a converter to the default state.
UEnumeration
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:44
ucnv_usesFallback
U_CAPI UBool ucnv_usesFallback(const UConverter *cnv)
Determines if the converter uses fallback mappings or not.
UCNV_LMBCS_11
@ UCNV_LMBCS_11
Definition: ucnv.h:135
UCNV_LMBCS_2
@ UCNV_LMBCS_2
Definition: ucnv.h:123
ucnv_setSubstString
U_CAPI void ucnv_setSubstString(UConverter *cnv, const UChar *s, int32_t length, UErrorCode *err)
Set a substitution string for converting from Unicode to a charset.
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
UCNV_LMBCS_6
@ UCNV_LMBCS_6
Definition: ucnv.h:131
UCNV_ROUNDTRIP_SET
@ UCNV_ROUNDTRIP_SET
Select the set of roundtrippable Unicode code points.
Definition: ucnv.h:945
ucnv_countStandards
U_CAPI uint16_t ucnv_countStandards(void)
Gives the number of standards associated to converter names.
UCNV_ROUNDTRIP_AND_FALLBACK_SET
@ UCNV_ROUNDTRIP_AND_FALLBACK_SET
Select the set of Unicode code points with roundtrip or fallback mappings.
Definition: ucnv.h:947
ucnv_toUChars
U_CAPI int32_t ucnv_toUChars(UConverter *cnv, UChar *dest, int32_t destCapacity, const char *src, int32_t srcLength, UErrorCode *pErrorCode)
Convert the codepage string into a Unicode string using an existing UConverter.
UCNV_UTF32
@ UCNV_UTF32
Definition: ucnv.h:161
USet
struct USet USet
USet is the C API type corresponding to C++ class UnicodeSet.
Definition: uset.h:50
UCNV_LMBCS_4
@ UCNV_LMBCS_4
Definition: ucnv.h:127
UCNV_LMBCS_8
@ UCNV_LMBCS_8
Definition: ucnv.h:133
UCNV_LATIN_1
@ UCNV_LATIN_1
Definition: ucnv.h:104
UCNV_BOCU1
@ UCNV_BOCU1
Definition: ucnv.h:157
ucnv_getCanonicalName
const U_CAPI char * ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode)
This function will return the internal canonical converter name of the tagged alias.
LocalUConverterPointer
UCNV_LMBCS_17
@ UCNV_LMBCS_17
Definition: ucnv.h:139
uenum.h
C API: String Enumeration.
UCNV_SBCS
@ UCNV_SBCS
Definition: ucnv.h:98
UCNV_UTF32_LittleEndian
@ UCNV_UTF32_LittleEndian
Definition: ucnv.h:114
ucnv_close
U_CAPI void ucnv_close(UConverter *converter)
Deletes the unicode converter and releases resources associated with just this instance.
UCNV_LMBCS_5
@ UCNV_LMBCS_5
Definition: ucnv.h:129
ucnv_open
U_CAPI UConverter * ucnv_open(const char *converterName, UErrorCode *err)
Creates a UConverter object with the name of a coded character set specified as a C string.