ICU 71.1: ucnv.h Source File

ICU 71.1 71.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
48#ifndef UCNV_H
49#define UCNV_H
50
51#include "unicode/ucnv_err.h"
52#include "unicode/uenum.h"
53
54#if U_SHOW_CPLUSPLUS_API
55#include "unicode/localpointer.h"
56#endif // U_SHOW_CPLUSPLUS_API
57
58#if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN)
59
60#define USET_DEFINED
61
70typedef struct USet USet;
71
72#endif
73
74#if !UCONFIG_NO_CONVERSION
75
76 U_CDECL_BEGIN
77
79#define UCNV_MAX_CONVERTER_NAME_LENGTH 60
81#define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
82
84#define UCNV_SI 0x0F
86#define UCNV_SO 0x0E
87
93 typedef enum {
95 UCNV_UNSUPPORTED_CONVERTER = -1,
97 UCNV_SBCS = 0,
99 UCNV_DBCS = 1,
101 UCNV_MBCS = 2,
103 UCNV_LATIN_1 = 3,
105 UCNV_UTF8 = 4,
107 UCNV_UTF16_BigEndian = 5,
109 UCNV_UTF16_LittleEndian = 6,
111 UCNV_UTF32_BigEndian = 7,
113 UCNV_UTF32_LittleEndian = 8,
115 UCNV_EBCDIC_STATEFUL = 9,
117 UCNV_ISO_2022 = 10,
118
120 UCNV_LMBCS_1 = 11,
122 UCNV_LMBCS_2,
124 UCNV_LMBCS_3,
126 UCNV_LMBCS_4,
128 UCNV_LMBCS_5,
130 UCNV_LMBCS_6,
132 UCNV_LMBCS_8,
134 UCNV_LMBCS_11,
136 UCNV_LMBCS_16,
138 UCNV_LMBCS_17,
140 UCNV_LMBCS_18,
142 UCNV_LMBCS_19,
144 UCNV_LMBCS_LAST = UCNV_LMBCS_19,
146 UCNV_HZ,
148 UCNV_SCSU,
150 UCNV_ISCII,
152 UCNV_US_ASCII,
154 UCNV_UTF7,
156 UCNV_BOCU1,
158 UCNV_UTF16,
160 UCNV_UTF32,
162 UCNV_CESU8,
164 UCNV_IMAP_MAILBOX,
166 UCNV_COMPOUND_TEXT,
167
168 /* Number of converter types for which we have conversion routines. */
169 UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
170} UConverterType;
171
181 typedef enum {
182 UCNV_UNKNOWN = -1,
183 UCNV_IBM = 0
184} UConverterPlatform;
185
201 typedef void (U_EXPORT2 *UConverterToUCallback) (
202 const void* context,
203 UConverterToUnicodeArgs *args,
204 const char *codeUnits,
205 int32_t length,
206 UConverterCallbackReason reason,
207 UErrorCode *pErrorCode);
208
224 typedef void (U_EXPORT2 *UConverterFromUCallback) (
225 const void* context,
226 UConverterFromUnicodeArgs *args,
227 const UChar* codeUnits,
228 int32_t length,
229 UChar32 codePoint,
230 UConverterCallbackReason reason,
231 UErrorCode *pErrorCode);
232
233 U_CDECL_END
234
240#define UCNV_OPTION_SEP_CHAR ','
241
247#define UCNV_OPTION_SEP_STRING ","
248
254#define UCNV_VALUE_SEP_CHAR '='
255
261#define UCNV_VALUE_SEP_STRING "="
262
271#define UCNV_LOCALE_OPTION_STRING ",locale="
272
284#define UCNV_VERSION_OPTION_STRING ",version="
285
296#define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
297
313 U_CAPI int U_EXPORT2
314ucnv_compareNames(const char *name1, const char *name2);
315
316
367 U_CAPI UConverter* U_EXPORT2
368ucnv_open(const char *converterName, UErrorCode *err);
369
370
397 U_CAPI UConverter* U_EXPORT2
398ucnv_openU(const UChar *name,
399 UErrorCode *err);
400
465 U_CAPI UConverter* U_EXPORT2
466ucnv_openCCSID(int32_t codepage,
467 UConverterPlatform platform,
468 UErrorCode * err);
469
500 U_CAPI UConverter* U_EXPORT2
501ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
502
513 U_CAPI UConverter* U_EXPORT2 ucnv_clone(const UConverter *cnv, UErrorCode *status);
514
515#ifndef U_HIDE_DEPRECATED_API
516
556 U_DEPRECATED UConverter * U_EXPORT2
557ucnv_safeClone(const UConverter *cnv,
558 void *stackBuffer,
559 int32_t *pBufferSize,
560 UErrorCode *status);
561
568#define U_CNV_SAFECLONE_BUFFERSIZE 1024
569
570#endif /* U_HIDE_DEPRECATED_API */
571
583 U_CAPI void U_EXPORT2
584ucnv_close(UConverter * converter);
585
586#if U_SHOW_CPLUSPLUS_API
587
588U_NAMESPACE_BEGIN
589
599 U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close);
600
601U_NAMESPACE_END
602
603#endif
604
622 U_CAPI void U_EXPORT2
623ucnv_getSubstChars(const UConverter *converter,
624 char *subChars,
625 int8_t *len,
626 UErrorCode *err);
627
647 U_CAPI void U_EXPORT2
648ucnv_setSubstChars(UConverter *converter,
649 const char *subChars,
650 int8_t len,
651 UErrorCode *err);
652
680 U_CAPI void U_EXPORT2
681ucnv_setSubstString(UConverter *cnv,
682 const UChar *s,
683 int32_t length,
684 UErrorCode *err);
685
699 U_CAPI void U_EXPORT2
700ucnv_getInvalidChars(const UConverter *converter,
701 char *errBytes,
702 int8_t *len,
703 UErrorCode *err);
704
718 U_CAPI void U_EXPORT2
719ucnv_getInvalidUChars(const UConverter *converter,
720 UChar *errUChars,
721 int8_t *len,
722 UErrorCode *err);
723
731 U_CAPI void U_EXPORT2
732ucnv_reset(UConverter *converter);
733
742 U_CAPI void U_EXPORT2
743ucnv_resetToUnicode(UConverter *converter);
744
753 U_CAPI void U_EXPORT2
754ucnv_resetFromUnicode(UConverter *converter);
755
806 U_CAPI int8_t U_EXPORT2
807ucnv_getMaxCharSize(const UConverter *converter);
808
828#define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
829 (((int32_t)(length)+10)*(int32_t)(maxCharSize))
830
839 U_CAPI int8_t U_EXPORT2
840ucnv_getMinCharSize(const UConverter *converter);
841
856 U_CAPI int32_t U_EXPORT2
857ucnv_getDisplayName(const UConverter *converter,
858 const char *displayLocale,
859 UChar *displayName,
860 int32_t displayNameCapacity,
861 UErrorCode *err);
862
873 U_CAPI const char * U_EXPORT2
874ucnv_getName(const UConverter *converter, UErrorCode *err);
875
899 U_CAPI int32_t U_EXPORT2
900ucnv_getCCSID(const UConverter *converter,
901 UErrorCode *err);
902
913 U_CAPI UConverterPlatform U_EXPORT2
914ucnv_getPlatform(const UConverter *converter,
915 UErrorCode *err);
916
925 U_CAPI UConverterType U_EXPORT2
926ucnv_getType(const UConverter * converter);
927
943 U_CAPI void U_EXPORT2
944ucnv_getStarters(const UConverter* converter,
945 UBool starters[256],
946 UErrorCode* err);
947
948
954 typedef enum UConverterUnicodeSet {
956 UCNV_ROUNDTRIP_SET,
958 UCNV_ROUNDTRIP_AND_FALLBACK_SET,
959#ifndef U_HIDE_DEPRECATED_API
964 UCNV_SET_COUNT
965#endif // U_HIDE_DEPRECATED_API
966} UConverterUnicodeSet;
967
968
1014 U_CAPI void U_EXPORT2
1015ucnv_getUnicodeSet(const UConverter *cnv,
1016 USet *setFillIn,
1017 UConverterUnicodeSet whichSet,
1018 UErrorCode *pErrorCode);
1019
1031 U_CAPI void U_EXPORT2
1032ucnv_getToUCallBack (const UConverter * converter,
1033 UConverterToUCallback *action,
1034 const void **context);
1035
1047 U_CAPI void U_EXPORT2
1048ucnv_getFromUCallBack (const UConverter * converter,
1049 UConverterFromUCallback *action,
1050 const void **context);
1051
1067 U_CAPI void U_EXPORT2
1068ucnv_setToUCallBack (UConverter * converter,
1069 UConverterToUCallback newAction,
1070 const void* newContext,
1071 UConverterToUCallback *oldAction,
1072 const void** oldContext,
1073 UErrorCode * err);
1074
1090 U_CAPI void U_EXPORT2
1091ucnv_setFromUCallBack (UConverter * converter,
1092 UConverterFromUCallback newAction,
1093 const void *newContext,
1094 UConverterFromUCallback *oldAction,
1095 const void **oldContext,
1096 UErrorCode * err);
1097
1156 U_CAPI void U_EXPORT2
1157ucnv_fromUnicode (UConverter * converter,
1158 char **target,
1159 const char *targetLimit,
1160 const UChar ** source,
1161 const UChar * sourceLimit,
1162 int32_t* offsets,
1163 UBool flush,
1164 UErrorCode * err);
1165
1225 U_CAPI void U_EXPORT2
1226ucnv_toUnicode(UConverter *converter,
1227 UChar **target,
1228 const UChar *targetLimit,
1229 const char **source,
1230 const char *sourceLimit,
1231 int32_t *offsets,
1232 UBool flush,
1233 UErrorCode *err);
1234
1262 U_CAPI int32_t U_EXPORT2
1263ucnv_fromUChars(UConverter *cnv,
1264 char *dest, int32_t destCapacity,
1265 const UChar *src, int32_t srcLength,
1266 UErrorCode *pErrorCode);
1267
1294 U_CAPI int32_t U_EXPORT2
1295ucnv_toUChars(UConverter *cnv,
1296 UChar *dest, int32_t destCapacity,
1297 const char *src, int32_t srcLength,
1298 UErrorCode *pErrorCode);
1299
1370 U_CAPI UChar32 U_EXPORT2
1371ucnv_getNextUChar(UConverter * converter,
1372 const char **source,
1373 const char * sourceLimit,
1374 UErrorCode * err);
1375
1514 U_CAPI void U_EXPORT2
1515ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
1516 char **target, const char *targetLimit,
1517 const char **source, const char *sourceLimit,
1518 UChar *pivotStart, UChar **pivotSource,
1519 UChar **pivotTarget, const UChar *pivotLimit,
1520 UBool reset, UBool flush,
1521 UErrorCode *pErrorCode);
1522
1578 U_CAPI int32_t U_EXPORT2
1579ucnv_convert(const char *toConverterName,
1580 const char *fromConverterName,
1581 char *target,
1582 int32_t targetCapacity,
1583 const char *source,
1584 int32_t sourceLength,
1585 UErrorCode *pErrorCode);
1586
1632 U_CAPI int32_t U_EXPORT2
1633ucnv_toAlgorithmic(UConverterType algorithmicType,
1634 UConverter *cnv,
1635 char *target, int32_t targetCapacity,
1636 const char *source, int32_t sourceLength,
1637 UErrorCode *pErrorCode);
1638
1684 U_CAPI int32_t U_EXPORT2
1685ucnv_fromAlgorithmic(UConverter *cnv,
1686 UConverterType algorithmicType,
1687 char *target, int32_t targetCapacity,
1688 const char *source, int32_t sourceLength,
1689 UErrorCode *pErrorCode);
1690
1698 U_CAPI int32_t U_EXPORT2
1699ucnv_flushCache(void);
1700
1708 U_CAPI int32_t U_EXPORT2
1709ucnv_countAvailable(void);
1710
1721 U_CAPI const char* U_EXPORT2
1722ucnv_getAvailableName(int32_t n);
1723
1736 U_CAPI UEnumeration * U_EXPORT2
1737ucnv_openAllNames(UErrorCode *pErrorCode);
1738
1749 U_CAPI uint16_t U_EXPORT2
1750ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
1751
1764 U_CAPI const char * U_EXPORT2
1765ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
1766
1780 U_CAPI void U_EXPORT2
1781ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
1782
1806 U_CAPI UEnumeration * U_EXPORT2
1807ucnv_openStandardNames(const char *convName,
1808 const char *standard,
1809 UErrorCode *pErrorCode);
1810
1816 U_CAPI uint16_t U_EXPORT2
1817ucnv_countStandards(void);
1818
1826 U_CAPI const char * U_EXPORT2
1827ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
1828
1848 U_CAPI const char * U_EXPORT2
1849ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
1850
1870 U_CAPI const char * U_EXPORT2
1871ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
1872
1887 U_CAPI const char * U_EXPORT2
1888ucnv_getDefaultName(void);
1889
1890#ifndef U_HIDE_SYSTEM_API
1907 U_CAPI void U_EXPORT2
1908ucnv_setDefaultName(const char *name);
1909#endif /* U_HIDE_SYSTEM_API */
1910
1928 U_CAPI void U_EXPORT2
1929ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
1930
1939 U_CAPI UBool U_EXPORT2
1940ucnv_isAmbiguous(const UConverter *cnv);
1941
1957 U_CAPI void U_EXPORT2
1958ucnv_setFallback(UConverter *cnv, UBool usesFallback);
1959
1969 U_CAPI UBool U_EXPORT2
1970ucnv_usesFallback(const UConverter *cnv);
1971
2001 U_CAPI const char* U_EXPORT2
2002ucnv_detectUnicodeSignature(const char* source,
2003 int32_t sourceLength,
2004 int32_t *signatureLength,
2005 UErrorCode *pErrorCode);
2006
2018 U_CAPI int32_t U_EXPORT2
2019ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
2020
2032 U_CAPI int32_t U_EXPORT2
2033ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
2034
2050 U_CAPI UBool U_EXPORT2
2051ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status);
2052
2053#endif
2054
2055#endif
2056/*_UCNV*/
LocalUConverterPointer
"Smart pointer" class, closes a UConverter via ucnv_close().
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:550
UConverterFromUnicodeArgs
The structure for the fromUnicode callback function parameter.
Definition: ucnv_err.h:194
UConverterToUnicodeArgs
The structure for the toUnicode callback function parameter.
Definition: ucnv_err.h:210
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:201
ucnv_usesFallback
U_CAPI UBool ucnv_usesFallback(const UConverter *cnv)
Determines if the converter uses fallback mappings or not.
ucnv_safeClone
UConverter * ucnv_safeClone(const UConverter *cnv, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status)
Thread safe converter cloning operation.
ucnv_openPackage
U_CAPI UConverter * ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err)
ucnv_isAmbiguous
U_CAPI UBool ucnv_isAmbiguous(const UConverter *cnv)
Determines if the converter contains ambiguous mappings of the same character or not.
ucnv_setDefaultName
U_CAPI void ucnv_setDefaultName(const char *name)
This function is not thread safe.
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.
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:224
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.
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_getAlias
U_CAPI const char * ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode)
Gives the name of the alias at given index of alias list.
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.
ucnv_getStandardName
U_CAPI const char * ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode)
Returns a standard name for a given converter name.
UConverterUnicodeSet
UConverterUnicodeSet
Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet().
Definition: ucnv.h:954
UCNV_SET_COUNT
@ UCNV_SET_COUNT
Number of UConverterUnicodeSet selectors.
Definition: ucnv.h:964
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:958
UCNV_ROUNDTRIP_SET
@ UCNV_ROUNDTRIP_SET
Select the set of roundtrippable Unicode code points.
Definition: ucnv.h:956
ucnv_flushCache
U_CAPI int32_t ucnv_flushCache(void)
Frees up memory occupied by unused, cached converter shared data.
ucnv_resetFromUnicode
U_CAPI void ucnv_resetFromUnicode(UConverter *converter)
Resets the from-Unicode part of a converter state to the default state.
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.
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_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.
ucnv_getCanonicalName
U_CAPI const char * ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode)
This function will return the internal canonical converter name of the tagged alias.
ucnv_setFallback
U_CAPI void ucnv_setFallback(UConverter *cnv, UBool usesFallback)
Sets the converter to use fallback mappings or not.
ucnv_getMinCharSize
U_CAPI int8_t ucnv_getMinCharSize(const UConverter *converter)
Returns the minimum byte length (per codepoint) for characters in this codepage.
ucnv_clone
U_CAPI UConverter * ucnv_clone(const UConverter *cnv, UErrorCode *status)
Thread safe converter cloning operation.
ucnv_reset
U_CAPI void ucnv_reset(UConverter *converter)
Resets the state of a converter to the default state.
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_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_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.
ucnv_getName
U_CAPI const char * ucnv_getName(const UConverter *converter, UErrorCode *err)
Gets the internal, canonical name of the converter (zero-terminated).
ucnv_getToUCallBack
U_CAPI void ucnv_getToUCallBack(const UConverter *converter, UConverterToUCallback *action, const void **context)
Gets the current callback function used by the converter when an illegal or invalid codepage sequence...
ucnv_detectUnicodeSignature
U_CAPI const 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_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_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_getType
U_CAPI UConverterType ucnv_getType(const UConverter *converter)
Gets the type of the converter e.g.
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_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_countStandards
U_CAPI uint16_t ucnv_countStandards(void)
Gives the number of standards associated to converter names.
ucnv_getStandard
U_CAPI const char * ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode)
Gives the name of the standard at given index of standard list.
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_getAvailableName
U_CAPI const char * ucnv_getAvailableName(int32_t n)
Gets the canonical converter name of the specified converter from a list of all available converters ...
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_compareNames
U_CAPI int ucnv_compareNames(const char *name1, const char *name2)
Do a fuzzy compare of two converter/alias names.
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_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_countAvailable
U_CAPI int32_t ucnv_countAvailable(void)
Returns the number of available converters, as per the alias file.
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.
UConverterPlatform
UConverterPlatform
Enum for specifying which platform a converter ID refers to.
Definition: ucnv.h:181
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_getCCSID
U_CAPI int32_t ucnv_getCCSID(const UConverter *converter, UErrorCode *err)
Gets a codepage number associated with the converter.
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_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_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_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.
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 ...
UConverterType
UConverterType
Enum for specifying basic types of converters.
Definition: ucnv.h:93
UCNV_HZ
@ UCNV_HZ
Definition: ucnv.h:146
UCNV_LMBCS_11
@ UCNV_LMBCS_11
Definition: ucnv.h:134
UCNV_ISO_2022
@ UCNV_ISO_2022
Definition: ucnv.h:117
UCNV_LATIN_1
@ UCNV_LATIN_1
Definition: ucnv.h:103
UCNV_COMPOUND_TEXT
@ UCNV_COMPOUND_TEXT
Definition: ucnv.h:166
UCNV_LMBCS_19
@ UCNV_LMBCS_19
Definition: ucnv.h:142
UCNV_UTF32_BigEndian
@ UCNV_UTF32_BigEndian
Definition: ucnv.h:111
UCNV_LMBCS_17
@ UCNV_LMBCS_17
Definition: ucnv.h:138
UCNV_LMBCS_6
@ UCNV_LMBCS_6
Definition: ucnv.h:130
UCNV_UTF32
@ UCNV_UTF32
Definition: ucnv.h:160
UCNV_ISCII
@ UCNV_ISCII
Definition: ucnv.h:150
UCNV_LMBCS_3
@ UCNV_LMBCS_3
Definition: ucnv.h:124
UCNV_IMAP_MAILBOX
@ UCNV_IMAP_MAILBOX
Definition: ucnv.h:164
UCNV_UTF8
@ UCNV_UTF8
Definition: ucnv.h:105
UCNV_SBCS
@ UCNV_SBCS
Definition: ucnv.h:97
UCNV_UTF16_LittleEndian
@ UCNV_UTF16_LittleEndian
Definition: ucnv.h:109
UCNV_UNSUPPORTED_CONVERTER
@ UCNV_UNSUPPORTED_CONVERTER
Definition: ucnv.h:95
UCNV_LMBCS_16
@ UCNV_LMBCS_16
Definition: ucnv.h:136
UCNV_UTF32_LittleEndian
@ UCNV_UTF32_LittleEndian
Definition: ucnv.h:113
UCNV_LMBCS_8
@ UCNV_LMBCS_8
Definition: ucnv.h:132
UCNV_US_ASCII
@ UCNV_US_ASCII
Definition: ucnv.h:152
UCNV_LMBCS_2
@ UCNV_LMBCS_2
Definition: ucnv.h:122
UCNV_UTF16
@ UCNV_UTF16
Definition: ucnv.h:158
UCNV_UTF16_BigEndian
@ UCNV_UTF16_BigEndian
Definition: ucnv.h:107
UCNV_LMBCS_5
@ UCNV_LMBCS_5
Definition: ucnv.h:128
UCNV_EBCDIC_STATEFUL
@ UCNV_EBCDIC_STATEFUL
Definition: ucnv.h:115
UCNV_MBCS
@ UCNV_MBCS
Definition: ucnv.h:101
UCNV_LMBCS_4
@ UCNV_LMBCS_4
Definition: ucnv.h:126
UCNV_SCSU
@ UCNV_SCSU
Definition: ucnv.h:148
UCNV_UTF7
@ UCNV_UTF7
Definition: ucnv.h:154
UCNV_LMBCS_18
@ UCNV_LMBCS_18
Definition: ucnv.h:140
UCNV_BOCU1
@ UCNV_BOCU1
Definition: ucnv.h:156
UCNV_LMBCS_LAST
@ UCNV_LMBCS_LAST
Definition: ucnv.h:144
UCNV_LMBCS_1
@ UCNV_LMBCS_1
Definition: ucnv.h:120
UCNV_DBCS
@ UCNV_DBCS
Definition: ucnv.h:99
UCNV_CESU8
@ UCNV_CESU8
Definition: ucnv.h:162
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_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_fixFileSeparator
U_CAPI void ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen)
Fixes the backslash character mismapping.
ucnv_close
U_CAPI void ucnv_close(UConverter *converter)
Deletes the unicode converter and releases resources associated with just this instance.
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_resetToUnicode
U_CAPI void ucnv_resetToUnicode(UConverter *converter)
Resets the to-Unicode part of a converter state to the default state.
ucnv_getDefaultName
U_CAPI const char * ucnv_getDefaultName(void)
Returns the current default converter name.
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_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_getPlatform
U_CAPI UConverterPlatform ucnv_getPlatform(const UConverter *converter, UErrorCode *err)
Gets a codepage platform associated with the converter.
ucnv_err.h
C UConverter predefined error callbacks.
UConverter
struct UConverter UConverter
Definition: ucnv_err.h:96
UConverterCallbackReason
UConverterCallbackReason
The process condition code to be used with the callbacks.
Definition: ucnv_err.h:157
uenum.h
C API: String Enumeration.
UEnumeration
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:44
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:467
U_DEPRECATED
#define U_DEPRECATED
This is used to declare a function as a deprecated public ICU C API
Definition: umachine.h:116
U_CDECL_END
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
Definition: umachine.h:86
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:418
U_CDECL_BEGIN
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition: umachine.h:85
USet
struct USet USet
USet is the C API type corresponding to C++ class UnicodeSet.
Definition: uset.h:50
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415