Apr 18, 2011 14:52
ucnv.h File Reference
C API: Character conversion. More...
#include "unicode/ucnv_err.h"
#include "unicode/uenum.h"
#include "unicode/localpointer.h"
Go to the source code of this file.
Defines
#define UCNV_MAX_CONVERTER_NAME_LENGTH 60
Maximum length of a converter name including the terminating NULL.
#define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
Maximum length of a converter name including path and terminating NULL.
#define UCNV_SI 0x0F
Shift in for EBDCDIC_STATEFUL and iso2022 states.
#define UCNV_SO 0x0E
Shift out for EBDCDIC_STATEFUL and iso2022 states.
#define UCNV_OPTION_SEP_CHAR ','
Character that separates converter names from options and options from each other.
#define UCNV_OPTION_SEP_STRING ","
String version of UCNV_OPTION_SEP_CHAR.
#define UCNV_VALUE_SEP_CHAR '='
Character that separates a converter option from its value.
#define UCNV_VALUE_SEP_STRING "="
String version of UCNV_VALUE_SEP_CHAR.
#define UCNV_LOCALE_OPTION_STRING ",locale="
Converter option for specifying a locale.
#define UCNV_VERSION_OPTION_STRING ",version="
Converter option for specifying a version selector (0..9) for some converters.
#define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
Converter option for EBCDIC SBCS or mixed-SBCS/DBCS (stateful) codepages.
#define U_CNV_SAFECLONE_BUFFERSIZE 1024
Definition of a buffer size that is designed to be large enough for converters to be cloned with ucnv_safeClone().
#define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) (((int32_t)(length)+10)*(int32_t)(maxCharSize))
Calculates the size of a buffer for conversion from Unicode to a charset.
Typedefs
typedef struct USet USet
typedef 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.
typedef 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.
typedef enum UConverterUnicodeSet UConverterUnicodeSet
Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet().
Enumerations
enum UConverterType {
UCNV_UNSUPPORTED_CONVERTER = -1, UCNV_SBCS = 0, UCNV_DBCS = 1, UCNV_MBCS = 2,
UCNV_LATIN_1 = 3, UCNV_UTF8 = 4, UCNV_UTF16_BigEndian = 5, UCNV_UTF16_LittleEndian = 6,
UCNV_UTF32_BigEndian = 7, UCNV_UTF32_LittleEndian = 8, UCNV_EBCDIC_STATEFUL = 9, UCNV_ISO_2022 = 10,
UCNV_LMBCS_1 = 11, UCNV_LMBCS_2, UCNV_LMBCS_3, UCNV_LMBCS_4,
UCNV_LMBCS_5, UCNV_LMBCS_6, UCNV_LMBCS_8, UCNV_LMBCS_11,
UCNV_LMBCS_16, UCNV_LMBCS_17, UCNV_LMBCS_18, UCNV_LMBCS_19,
UCNV_LMBCS_LAST = UCNV_LMBCS_19, UCNV_HZ, UCNV_SCSU, UCNV_ISCII,
UCNV_US_ASCII, UCNV_UTF7, UCNV_BOCU1, UCNV_UTF16,
UCNV_UTF32, UCNV_CESU8, UCNV_IMAP_MAILBOX, UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
}
Enum for specifying basic types of converters.
More...
enum UConverterPlatform { UCNV_UNKNOWN = -1, UCNV_IBM = 0 }
Enum for specifying which platform a converter ID refers to.
More...
enum UConverterUnicodeSet { UCNV_ROUNDTRIP_SET, UCNV_ROUNDTRIP_AND_FALLBACK_SET, UCNV_SET_COUNT }
Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet().
More...
Functions
int ucnv_compareNames (const char *name1, const char *name2)
Do a fuzzy compare of two converter/alias names.
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.
UConverter * ucnv_openU (const UChar *name, UErrorCode *err)
Creates a Unicode converter with the names specified as unicode string.
UConverter * ucnv_openCCSID (int32_t codepage, UConverterPlatform platform, UErrorCode *err)
Creates a UConverter object from a CCSID number and platform pair.
UConverter * ucnv_openPackage (const char *packageName, const char *converterName, UErrorCode *err)
UConverter * ucnv_safeClone (const UConverter *cnv, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status)
Thread safe converter cloning operation.
void ucnv_close (UConverter *converter)
Deletes the unicode converter and releases resources associated with just this instance.
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.
void ucnv_setSubstChars (UConverter *converter, const char *subChars, int8_t len, UErrorCode *err)
Sets the substitution chars when converting from unicode to a codepage.
void ucnv_setSubstString (UConverter *cnv, const UChar *s, int32_t length, UErrorCode *err)
Set a substitution string for converting from Unicode to a charset.
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.
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.
void ucnv_reset (UConverter *converter)
Resets the state of a converter to the default state.
void ucnv_resetToUnicode (UConverter *converter)
Resets the to-Unicode part of a converter state to the default state.
void ucnv_resetFromUnicode (UConverter *converter)
Resets the from-Unicode part of a converter state to the default state.
int8_t ucnv_getMaxCharSize (const UConverter *converter)
Returns the maximum number of bytes that are output per UChar in conversion from Unicode using this converter.
int8_t ucnv_getMinCharSize (const UConverter *converter)
Returns the minimum byte length for characters in this codepage.
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.
const char * ucnv_getName (const UConverter *converter, UErrorCode *err)
Gets the internal, canonical name of the converter (zero-terminated).
int32_t ucnv_getCCSID (const UConverter *converter, UErrorCode *err)
Gets a codepage number associated with the converter.
UConverterPlatform ucnv_getPlatform (const UConverter *converter, UErrorCode *err)
Gets a codepage platform associated with the converter.
UConverterType ucnv_getType (const UConverter *converter)
Gets the type of the converter e.g.
void ucnv_getStarters (const UConverter *converter, UBool starters[256], UErrorCode *err)
Gets the "starter" (lead) bytes for converters of type MBCS.
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.
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 is found.
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 found.
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.