diff --git a/icu4c/source/common/ucnv_io.c b/icu4c/source/common/ucnv_io.c index 0d3e4c82e56..cf4c7f9ec8b 100644 --- a/icu4c/source/common/ucnv_io.c +++ b/icu4c/source/common/ucnv_io.c @@ -63,8 +63,8 @@ * 3) This section contains a list of sorted unique aliases. This * list contains indexes into the string table for the alias name. The * index of this list is also used by other sections, like the 4th section. - * The index for the 3rd and 4th section can be used to get the - * alias <-> converter name mapping. + * The index for the 3rd and 4th section is used to get the + * alias -> converter name mapping. Section 3 and 4 form a two column table. * * 4) This section contains a list of mapped converter names. Consider this * as a table that maps the 3rd section to the 1st section. This list contains @@ -148,40 +148,38 @@ * Used by the UEnumeration API */ typedef struct UAliasContext { - uint32_t standardNum; - uint32_t convNum; + uint32_t listOffset; uint32_t listIdx; } UAliasContext; static const char DATA_NAME[] = "cnvalias"; static const char DATA_TYPE[] = "icu"; -static UDataMemory *aliasData=NULL; +static UDataMemory *gAliasData=NULL; -static const uint16_t *converterList = NULL; -static const uint16_t *tagList = NULL; -static const uint16_t *aliasList = NULL; -static const uint16_t *untaggedConvArray = NULL; -static const uint16_t *taggedAliasArray = NULL; -static const uint16_t *taggedAliasLists = NULL; -static const uint16_t *stringTable = NULL; +static const uint16_t *gConverterList = NULL; +static const uint16_t *gTagList = NULL; +static const uint16_t *gAliasList = NULL; +static const uint16_t *gUntaggedConvArray = NULL; +static const uint16_t *gTaggedAliasArray = NULL; +static const uint16_t *gTaggedAliasLists = NULL; +static const uint16_t *gStringTable = NULL; -static uint32_t converterListNum; -static uint32_t tagListNum; -static uint32_t aliasListNum; -static uint32_t untaggedConvArraySize; -static uint32_t taggedAliasArraySize; -static uint32_t taggedAliasListsSize; -static uint32_t stringTableSize; +static uint32_t gConverterListSize; +static uint32_t gTagListSize; +static uint32_t gAliasListSize; +static uint32_t gUntaggedConvArraySize; +static uint32_t gTaggedAliasArraySize; +static uint32_t gTaggedAliasListsSize; +static uint32_t gStringTableSize; -static const char **availableConverters = NULL; -static uint16_t availableConverterCount = 0; +static const char **gAvailableConverters = NULL; +static uint16_t gAvailableConverterCount = 0; -static char defaultConverterNameBuffer[UCNV_MAX_CONVERTER_NAME_LENGTH + 1]; /* +1 for NULL */ -static const char *defaultConverterName = NULL; +static char gDefaultConverterNameBuffer[UCNV_MAX_CONVERTER_NAME_LENGTH + 1]; /* +1 for NULL */ +static const char *gDefaultConverterName = NULL; -#define GET_STRING(idx) (const char *)(stringTable + (idx)) -#define NUM_RESERVED_TAGS 2 +#define GET_STRING(idx) (const char *)(gStringTable + (idx)) static UBool U_CALLCONV isAcceptable(void *context, @@ -205,7 +203,7 @@ haveAliasData(UErrorCode *pErrorCode) { } /* load converter alias data from file if necessary */ - if(aliasData==NULL) { + if(gAliasData==NULL) { UDataMemory *data = NULL; const uint16_t *table = NULL; uint32_t tableStart; @@ -227,43 +225,43 @@ haveAliasData(UErrorCode *pErrorCode) { } umtx_lock(NULL); - if(aliasData==NULL) { - aliasData = data; + if(gAliasData==NULL) { + gAliasData = data; data=NULL; - converterListNum = ((const uint32_t *)(table))[1]; - tagListNum = ((const uint32_t *)(table))[2]; - aliasListNum = ((const uint32_t *)(table))[3]; - untaggedConvArraySize = ((const uint32_t *)(table))[4]; - taggedAliasArraySize = ((const uint32_t *)(table))[5]; - taggedAliasListsSize = ((const uint32_t *)(table))[6]; + gConverterListSize = ((const uint32_t *)(table))[1]; + gTagListSize = ((const uint32_t *)(table))[2]; + gAliasListSize = ((const uint32_t *)(table))[3]; + gUntaggedConvArraySize = ((const uint32_t *)(table))[4]; + gTaggedAliasArraySize = ((const uint32_t *)(table))[5]; + gTaggedAliasListsSize = ((const uint32_t *)(table))[6]; reservedSize1 = ((const uint32_t *)(table))[7]; /* reserved */ - stringTableSize = ((const uint32_t *)(table))[8]; + gStringTableSize = ((const uint32_t *)(table))[8]; currOffset = tableStart * (sizeof(uint32_t)/sizeof(uint16_t)) + (sizeof(uint32_t)/sizeof(uint16_t)); - converterList = table + currOffset; + gConverterList = table + currOffset; - currOffset += converterListNum; - tagList = table + currOffset; + currOffset += gConverterListSize; + gTagList = table + currOffset; - currOffset += tagListNum; - aliasList = table + currOffset; + currOffset += gTagListSize; + gAliasList = table + currOffset; - currOffset += aliasListNum; - untaggedConvArray = table + currOffset; + currOffset += gAliasListSize; + gUntaggedConvArray = table + currOffset; - currOffset += untaggedConvArraySize; - taggedAliasArray = table + currOffset; + currOffset += gUntaggedConvArraySize; + gTaggedAliasArray = table + currOffset; /* aliasLists is a 1's based array, but it has a padding character */ - currOffset += taggedAliasArraySize; - taggedAliasLists = table + currOffset; + currOffset += gTaggedAliasArraySize; + gTaggedAliasLists = table + currOffset; - currOffset += taggedAliasListsSize; + currOffset += gTaggedAliasListsSize; /* reserved */ currOffset += reservedSize1; - stringTable = table + currOffset; + gStringTable = table + currOffset; } umtx_unlock(NULL); @@ -277,7 +275,7 @@ haveAliasData(UErrorCode *pErrorCode) { return TRUE; } -static UBool +U_INLINE static UBool isAlias(const char *alias, UErrorCode *pErrorCode) { if(alias==NULL) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; @@ -292,41 +290,41 @@ isAlias(const char *alias, UErrorCode *pErrorCode) { UBool ucnv_io_cleanup() { - if (aliasData) { - udata_close(aliasData); - aliasData = NULL; + if (gAliasData) { + udata_close(gAliasData); + gAliasData = NULL; } ucnv_io_flushAvailableConverterCache(); - converterListNum = 0; - tagListNum = 0; - aliasListNum = 0; - untaggedConvArraySize = 0; - taggedAliasArraySize = 0; - taggedAliasListsSize = 0; - stringTableSize = 0; + gConverterListSize = 0; + gTagListSize = 0; + gAliasListSize = 0; + gUntaggedConvArraySize = 0; + gTaggedAliasArraySize = 0; + gTaggedAliasListsSize = 0; + gStringTableSize = 0; - converterList = NULL; - tagList = NULL; - aliasList = NULL; - untaggedConvArray = NULL; - taggedAliasArray = NULL; - taggedAliasLists = NULL; - stringTable = NULL; + gConverterList = NULL; + gTagList = NULL; + gAliasList = NULL; + gUntaggedConvArray = NULL; + gTaggedAliasArray = NULL; + gTaggedAliasLists = NULL; + gStringTable = NULL; - defaultConverterName = NULL; - defaultConverterNameBuffer[0] = 0; + gDefaultConverterName = NULL; + gDefaultConverterNameBuffer[0] = 0; return TRUE; /* Everything was cleaned up */ } static uint32_t getTagNumber(const char *tagname) { - if (tagList) { + if (gTagList) { uint32_t tagNum; - for (tagNum = 0; tagNum < tagListNum; tagNum++) { - if (!uprv_stricmp(GET_STRING(tagList[tagNum]), tagname)) { + for (tagNum = 0; tagNum < gTagListSize; tagNum++) { + if (!uprv_stricmp(GET_STRING(gTagList[tagNum]), tagname)) { return tagNum; } } @@ -384,7 +382,7 @@ ucnv_compareNames(const char *name1, const char *name2) { /* * search for an alias - * return the converter number index for converterList + * return the converter number index for gConverterList */ static uint32_t findConverter(const char *alias, UErrorCode *pErrorCode) { @@ -393,13 +391,13 @@ findConverter(const char *alias, UErrorCode *pErrorCode) { /* do a binary search for the alias */ start = 0; - limit = untaggedConvArraySize - 1; + limit = gUntaggedConvArraySize - 1; mid = limit; /* Once mid == 0 we've already checked the 0'th element and we can stop */ while (start <= limit && mid != 0) { mid = (uint32_t)((start + limit + 1) / 2); /* +1 is to round properly */ - result = ucnv_compareNames(alias, GET_STRING(aliasList[mid])); + result = ucnv_compareNames(alias, GET_STRING(gAliasList[mid])); if (result < 0) { limit = mid-1; @@ -407,25 +405,82 @@ findConverter(const char *alias, UErrorCode *pErrorCode) { start = mid+1; } else { /* Since the gencnval tool folds duplicates into one entry, - * this alias in aliasList is unique, but different standards + * this alias in gAliasList is unique, but different standards * may map an alias to different converters. */ - if (untaggedConvArray[mid] & UCNV_AMBIGUOUS_ALIAS_MAP_BIT) { + if (gUntaggedConvArray[mid] & UCNV_AMBIGUOUS_ALIAS_MAP_BIT) { *pErrorCode = U_AMBIGUOUS_ALIAS_WARNING; } - return untaggedConvArray[mid] & UCNV_CONVERTER_INDEX_MASK; + return gUntaggedConvArray[mid] & UCNV_CONVERTER_INDEX_MASK; } } return UINT32_MAX; } +/* + * Search for an standard name of an alias (what is the default name + * that this standard uses?) + * return the listOffset for gTaggedAliasLists. If it's 0, + * the it couldn't be found, but the parameters are valid. + */ +static uint32_t +findTaggedAliasListsOffset(const char *alias, const char *standard, UErrorCode *pErrorCode) { + uint32_t idx; + uint32_t listOffset; + uint32_t convNum; + UErrorCode myErr = U_ZERO_ERROR; + uint32_t tagNum = getTagNumber(standard); + + /* Make a quick guess. Hopefully they used a TR22 canonical alias. */ + convNum = findConverter(alias, &myErr); + if (myErr != U_ZERO_ERROR) { + *pErrorCode = myErr; + } + + if (tagNum < (gTagListSize - UCNV_NUM_RESERVED_TAGS) && convNum < gConverterListSize) { + listOffset = gTaggedAliasArray[tagNum*gConverterListSize + convNum]; + if (listOffset && gTaggedAliasLists[listOffset + 1]) { + return listOffset; + } + if (myErr == U_AMBIGUOUS_ALIAS_WARNING) { + /* Uh Oh! They used an ambiguous alias. + We have to search the whole swiss cheese starting + at the highest standard affinity. + This may take a while. + */ + for (idx = 0; idx < gTaggedAliasArraySize; idx++) { + listOffset = gTaggedAliasArray[idx]; + if (listOffset) { + uint32_t currAlias; + uint32_t listCount = gTaggedAliasLists[listOffset]; + /* +1 to skip listCount */ + const uint16_t *currList = gTaggedAliasLists + listOffset + 1; + for (currAlias = 0; currAlias < listCount; currAlias++) { + if (currList[currAlias] + && ucnv_compareNames(alias, GET_STRING(currList[currAlias]))==0) + { + return listOffset; + } + } + } + } + /* The standard doesn't know about the alias */ + } + /* else no default name */ + return 0; + } + /* else converter or tag not found */ + + return UINT32_MAX; +} + U_CFUNC const char * ucnv_io_getConverterName(const char *alias, UErrorCode *pErrorCode) { if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) { uint32_t convNum = findConverter(alias, pErrorCode); - if (convNum < converterListNum) { - return GET_STRING(converterList[convNum]); + if (convNum < gConverterListSize) { + return GET_STRING(gConverterList[convNum]); } /* else converter not found */ } @@ -436,10 +491,10 @@ static int32_t U_CALLCONV ucnv_io_countStandardAliases(UEnumeration *enumerator, UErrorCode *pErrorCode) { int32_t value = 0; UAliasContext *myContext = (UAliasContext *)(enumerator->context); - uint32_t listOffset = taggedAliasArray[myContext->standardNum*converterListNum + myContext->convNum]; + uint32_t listOffset = myContext->listOffset; if (listOffset) { - value = taggedAliasLists[listOffset]; + value = gTaggedAliasLists[listOffset]; } return value; } @@ -450,11 +505,11 @@ ucnv_io_nextStandardAliases(UEnumeration *enumerator, UErrorCode *pErrorCode) { UAliasContext *myContext = (UAliasContext *)(enumerator->context); - uint32_t listOffset = taggedAliasArray[myContext->standardNum*converterListNum + myContext->convNum]; + uint32_t listOffset = myContext->listOffset; if (listOffset) { - uint32_t listCount = taggedAliasLists[listOffset]; - const uint16_t *currList = taggedAliasLists + listOffset + 1; + uint32_t listCount = gTaggedAliasLists[listOffset]; + const uint16_t *currList = gTaggedAliasLists + listOffset + 1; if (myContext->listIdx < listCount) { const char *myStr = GET_STRING(currList[myContext->listIdx++]); @@ -498,9 +553,9 @@ ucnv_openStandardNames(const char *convName, { UEnumeration *myEnum = NULL; if (haveAliasData(pErrorCode) && isAlias(convName, pErrorCode)) { - uint32_t convNum = findConverter(convName, pErrorCode); - uint32_t tagNum = getTagNumber(standard); - if (tagNum < (tagListNum - NUM_RESERVED_TAGS) && convNum < converterListNum) { + uint32_t listOffset = findTaggedAliasListsOffset(convName, standard, pErrorCode); + + if (listOffset < gTaggedAliasListsSize) { UAliasContext *myContext; myEnum = uprv_malloc(sizeof(UEnumeration)); @@ -516,8 +571,7 @@ ucnv_openStandardNames(const char *convName, return NULL; } myEnum->context = myContext; - myContext->standardNum = tagNum; - myContext->convNum = convNum; + myContext->listOffset = listOffset; myContext->listIdx = 0; } /* else converter or tag not found */ @@ -529,12 +583,12 @@ U_CFUNC uint16_t ucnv_io_countAliases(const char *alias, UErrorCode *pErrorCode) { if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) { uint32_t convNum = findConverter(alias, pErrorCode); - if (convNum < converterListNum) { + if (convNum < gConverterListSize) { /* tagListNum - 1 is the ALL tag */ - int32_t listOffset = taggedAliasArray[(tagListNum - 1)*converterListNum + convNum]; + int32_t listOffset = gTaggedAliasArray[(gTagListSize - 1)*gConverterListSize + convNum]; if (listOffset) { - return taggedAliasLists[listOffset]; + return gTaggedAliasLists[listOffset]; } /* else this shouldn't happen. internal program error */ } @@ -548,14 +602,14 @@ ucnv_io_getAliases(const char *alias, uint16_t start, const char **aliases, UErr if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) { uint32_t currAlias; uint32_t convNum = findConverter(alias, pErrorCode); - if (convNum < converterListNum) { + if (convNum < gConverterListSize) { /* tagListNum - 1 is the ALL tag */ - int32_t listOffset = taggedAliasArray[(tagListNum - 1)*converterListNum + convNum]; + int32_t listOffset = gTaggedAliasArray[(gTagListSize - 1)*gConverterListSize + convNum]; if (listOffset) { - uint32_t listCount = taggedAliasLists[listOffset]; + uint32_t listCount = gTaggedAliasLists[listOffset]; /* +1 to skip listCount */ - const uint16_t *currList = taggedAliasLists + listOffset + 1; + const uint16_t *currList = gTaggedAliasLists + listOffset + 1; for (currAlias = start; currAlias < listCount; currAlias++) { aliases[currAlias] = GET_STRING(currList[currAlias]); @@ -572,14 +626,14 @@ U_CFUNC const char * ucnv_io_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode) { if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) { uint32_t convNum = findConverter(alias, pErrorCode); - if (convNum < converterListNum) { + if (convNum < gConverterListSize) { /* tagListNum - 1 is the ALL tag */ - int32_t listOffset = taggedAliasArray[(tagListNum - 1)*converterListNum + convNum]; + int32_t listOffset = gTaggedAliasArray[(gTagListSize - 1)*gConverterListSize + convNum]; if (listOffset) { - uint32_t listCount = taggedAliasLists[listOffset]; + uint32_t listCount = gTaggedAliasLists[listOffset]; /* +1 to skip listCount */ - const uint16_t *currList = taggedAliasLists + listOffset + 1; + const uint16_t *currList = gTaggedAliasLists + listOffset + 1; if (n < listCount) { return GET_STRING(currList[n]); @@ -597,7 +651,7 @@ U_CFUNC uint16_t ucnv_io_countStandards(UErrorCode *pErrorCode) { if (haveAliasData(pErrorCode)) { /* Don't include the empty list */ - return (uint16_t)(tagListNum - NUM_RESERVED_TAGS); + return (uint16_t)(gTagListSize - UCNV_NUM_RESERVED_TAGS); } return 0; @@ -606,8 +660,8 @@ ucnv_io_countStandards(UErrorCode *pErrorCode) { U_CAPI const char * U_EXPORT2 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode) { if (haveAliasData(pErrorCode)) { - if (n < tagListNum - NUM_RESERVED_TAGS) { - return GET_STRING(tagList[n]); + if (n < gTagListSize - UCNV_NUM_RESERVED_TAGS) { + return GET_STRING(gTagList[n]); } *pErrorCode = U_INDEX_OUTOFBOUNDS_ERROR; } @@ -618,54 +672,18 @@ ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode) { U_CAPI const char * U_EXPORT2 ucnv_getStandardName(const char *alias, const char *standard, UErrorCode *pErrorCode) { if (haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) { - uint32_t idx; - uint32_t listOffset; - uint32_t convNum; - uint32_t tagNum = getTagNumber(standard); - UErrorCode myErr = U_ZERO_ERROR; + uint32_t listOffset = findTaggedAliasListsOffset(alias, standard, pErrorCode); - /* Make a quick guess. Hopefully they used a TR22 canonical alias. */ - convNum = findConverter(alias, &myErr); + if (listOffset < gTaggedAliasListsSize) { + const uint16_t *currList = gTaggedAliasLists + listOffset + 1; - if (tagNum < (tagListNum - NUM_RESERVED_TAGS) && convNum < converterListNum) { - if (myErr == U_AMBIGUOUS_ALIAS_WARNING) { - /* Uh Oh! They used an ambiguous alias. - Hopefully the standard knows the alias. - This may take a while. - */ - for (idx = 0; idx < converterListNum; idx++) { - listOffset = taggedAliasArray[tagNum*converterListNum + idx]; - if (listOffset) { - uint32_t currAlias; - uint32_t listCount = taggedAliasLists[listOffset]; - /* +1 to skip listCount */ - const uint16_t *currList = taggedAliasLists + listOffset + 1; - for (currAlias = 0; currAlias < listCount; currAlias++) { - if (currList[currAlias] - && ucnv_compareNames(alias, GET_STRING(currList[currAlias]))==0) - { - /* Get the preferred name from this list */ - if (currList[0]) { - return GET_STRING(currList[0]); - } - else { - /* Someone screwed up the alias table. */ - return NULL; - } - } - } - } - } - /* The standard doesn't know about the alias */ - *pErrorCode = U_AMBIGUOUS_ALIAS_WARNING; + /* Get the preferred name from this list */ + if (currList[0]) { + return GET_STRING(currList[0]); } - listOffset = taggedAliasArray[tagNum*converterListNum + convNum]; - if (listOffset && taggedAliasLists[listOffset + 1]) { - return GET_STRING(taggedAliasLists[listOffset + 1]); - } - /* else no default name */ + /* else someone screwed up the alias table. */ + /* *pErrorCode = U_INVALID_FORMAT_ERROR */ } - /* else converter or tag not found */ } return NULL; @@ -673,17 +691,17 @@ ucnv_getStandardName(const char *alias, const char *standard, UErrorCode *pError void ucnv_io_flushAvailableConverterCache() { - if (availableConverters) { + if (gAvailableConverters) { umtx_lock(NULL); - availableConverterCount = 0; - uprv_free((char **)availableConverters); - availableConverters = NULL; + gAvailableConverterCount = 0; + uprv_free((char **)gAvailableConverters); + gAvailableConverters = NULL; umtx_unlock(NULL); } } static UBool haveAvailableConverterList(UErrorCode *pErrorCode) { - if (availableConverters == NULL) { + if (gAvailableConverters == NULL) { uint16_t idx; uint16_t localConverterCount; UErrorCode status; @@ -695,7 +713,7 @@ static UBool haveAvailableConverterList(UErrorCode *pErrorCode) { } /* We can't have more than "*converterTable" converters to open */ - localConverterList = (const char **) uprv_malloc(converterListNum * sizeof(char*)); + localConverterList = (const char **) uprv_malloc(gConverterListSize * sizeof(char*)); if (!localConverterList) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; return FALSE; @@ -703,9 +721,9 @@ static UBool haveAvailableConverterList(UErrorCode *pErrorCode) { localConverterCount = 0; - for (idx = 0; idx < converterListNum; idx++) { + for (idx = 0; idx < gConverterListSize; idx++) { status = U_ZERO_ERROR; - converterName = GET_STRING(converterList[idx]); + converterName = GET_STRING(gConverterList[idx]); ucnv_close(ucnv_open(converterName, &status)); if (U_SUCCESS(status)) { localConverterList[localConverterCount++] = converterName; @@ -713,9 +731,9 @@ static UBool haveAvailableConverterList(UErrorCode *pErrorCode) { } umtx_lock(NULL); - if (availableConverters == NULL) { - availableConverters = localConverterList; - availableConverterCount = localConverterCount; + if (gAvailableConverters == NULL) { + gAvailableConverters = localConverterList; + gAvailableConverterCount = localConverterCount; } else { uprv_free((char **)localConverterList); @@ -728,7 +746,7 @@ static UBool haveAvailableConverterList(UErrorCode *pErrorCode) { U_CFUNC uint16_t ucnv_io_countAvailableConverters(UErrorCode *pErrorCode) { if (haveAvailableConverterList(pErrorCode)) { - return availableConverterCount; + return gAvailableConverterCount; } return 0; } @@ -736,8 +754,8 @@ ucnv_io_countAvailableConverters(UErrorCode *pErrorCode) { U_CFUNC const char * ucnv_io_getAvailableConverter(uint16_t n, UErrorCode *pErrorCode) { if (haveAvailableConverterList(pErrorCode)) { - if (n < availableConverterCount) { - return availableConverters[n]; + if (n < gAvailableConverterCount) { + return gAvailableConverters[n]; } *pErrorCode = U_INDEX_OUTOFBOUNDS_ERROR; } @@ -748,8 +766,8 @@ U_CFUNC void ucnv_io_fillAvailableConverters(const char **aliases, UErrorCode *pErrorCode) { if (haveAvailableConverterList(pErrorCode)) { uint16_t count = 0; - while (count < availableConverterCount) { - *aliases++=availableConverters[count++]; + while (count < gAvailableConverterCount) { + *aliases++=gAvailableConverters[count++]; } } } @@ -757,7 +775,7 @@ ucnv_io_fillAvailableConverters(const char **aliases, UErrorCode *pErrorCode) { U_CFUNC uint16_t ucnv_io_countAvailableAliases(UErrorCode *pErrorCode) { if (haveAliasData(pErrorCode)) { - return (uint16_t)aliasListNum; + return (uint16_t)gAliasListSize; } return 0; } @@ -775,7 +793,7 @@ ucnv_io_countAvailableAliases(UErrorCode *pErrorCode) { U_CFUNC const char * ucnv_io_getDefaultConverterName() { /* local variable to be thread-safe */ - const char *name=defaultConverterName; + const char *name=gDefaultConverterName; if(name==NULL) { const char *codepage = uprv_getDefaultCodepage(); if(codepage!=NULL) { @@ -807,7 +825,7 @@ ucnv_io_getDefaultConverterName() { if(name != NULL) { umtx_lock(NULL); /* Did find a name. And it works.*/ - defaultConverterName=name; + gDefaultConverterName=name; umtx_unlock(NULL); } } @@ -819,27 +837,27 @@ U_CFUNC void ucnv_io_setDefaultConverterName(const char *converterName) { if(converterName==NULL) { /* reset to the default codepage */ - defaultConverterName=NULL; + gDefaultConverterName=NULL; } else { UErrorCode errorCode=U_ZERO_ERROR; const char *name=ucnv_io_getConverterName(converterName, &errorCode); if(U_SUCCESS(errorCode) && name!=NULL) { - defaultConverterName=name; + gDefaultConverterName=name; } else { /* do not set the name if the alias lookup failed and it is too long */ int32_t length=(int32_t)(uprv_strlen(converterName)); - if(lengthUCNV_OPTION_SEP_CHAR between the name and the first option and * also between adjacent options.

* + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. * @param converterName : name of the uconv table, may have options appended * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR * @return the created Unicode converter object, or NULL if an error occured @@ -245,6 +247,8 @@ ucnv_open (const char *converterName, UErrorCode * err); * E.g., the names "UTF8", "utf-8", and "Utf 8" are all equivalent. * If NULL is passed for the converter name, it will create * one with the ucnv_getDefaultName() return value. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. * @param name : name of the uconv table in a zero terminated * Unicode string * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, @@ -308,6 +312,9 @@ ucnv_openU (const UChar * name, * cnv=ucnv_open(name, &errorCode); * \endcode * + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * * @param codepage codepage number to create * @param platform the platform in which the codepage number exists * @param err error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR @@ -1014,6 +1021,8 @@ ucnv_getAvailableName (int32_t n); /** * Gives the number of aliases for a given converter or alias name. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. * This method only enumerates the listed entries in the alias file. * @param alias alias name * @param pErrorCode error status @@ -1026,6 +1035,8 @@ ucnv_countAliases(const char *alias, UErrorCode *pErrorCode); /** * Gives the name of the alias at given index of alias list. * This method only enumerates the listed entries in the alias file. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. * @param alias alias name * @param n index in alias list * @param pErrorCode result of operation @@ -1039,6 +1050,8 @@ ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode); /** * Fill-up the list of alias names for the given alias. * This method only enumerates the listed entries in the alias file. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. * @param alias alias name * @param aliases fill-in list, aliases is a pointer to an array of * ucnv_countAliases() string-pointers diff --git a/icu4c/source/data/mappings/convrtrs.txt b/icu4c/source/data/mappings/convrtrs.txt index 289d4fb6568..f40a9360ab5 100644 --- a/icu4c/source/data/mappings/convrtrs.txt +++ b/icu4c/source/data/mappings/convrtrs.txt @@ -78,20 +78,21 @@ # be the first converter that will be opened. # # The general ordering is from specific and frequently used to more general -# and rarely used. +# or rarely used. { UTR22 # Name format specified by http://www.unicode.org/unicode/reports/tr22/ # ICU # Can also use ICU_FEATURE IBM # The IBM CCSID number is specified by ibm-* - WINDOWS # The Microsoft code page identifier number is specified by cp* + # WINDOWS # The Microsoft code page identifier number is specified by cp* JAVA # Source: Sun JDK. Preferred name must be an exact match. Alias name case is ignored, but dashes are not ignored. # GLIBC - # AIX DB2 + # AIX + # DB2 # SOLARIS # APPLE # HPUX IANA # Source: http://www.iana.org/assignments/character-sets MIME # Source: http://www.iana.org/assignments/character-sets - # MSIE # MSIE is Internet Explorer, which can be different from Windows + # MSIE # MSIE is Internet Explorer, which can be different from Windows (From the IMultiLanguage COM interface) ZOS_USS # z/OS (os/390) Unix System Services (USS), which has NL<->LF swapping. They have the same format as the IBM tag. } @@ -99,22 +100,38 @@ # Fully algorithmic converters -UTF-8 { IANA* MIME* } ibm-1208 ibm-1209 ibm-5304 ibm-5305 cp1208 cp65001 +UTF-8 { IANA* MIME* } ibm-1208 { IBM* } + ibm-1209 { IBM } + ibm-5304 { IBM } + ibm-5305 { IBM } + cp1208 + cp65001 # The ICU 2.2 UTF-16/32 converters detect and write a BOM. UTF-16 { IANA* MIME* } ISO-10646-UCS-2 { IANA } csUnicode ucs-2 -UTF-16BE { IANA* MIME* } UTF16_BigEndian x-utf-16be ibm-1200 ibm-1201 ibm-5297 ibm-13488 ibm-17584 cp1201 -UTF-16LE { IANA* MIME* } UTF16_LittleEndian x-utf-16le ibm-1202 ibm-13490 ibm-17586 cp1200 +UTF-16BE { IANA* MIME* } UTF16_BigEndian + x-utf-16be + ibm-1200 { IBM* } + ibm-1201 { IBM } + ibm-5297 { IBM } + ibm-13488 { IBM } + ibm-17584 { IBM } + cp1201 +UTF-16LE { IANA* MIME* } UTF16_LittleEndian + x-utf-16le + ibm-1202 { IBM* } + ibm-13490 { IBM } + ibm-17586 { IBM } + cp1200 + +UTF-32 { IANA* MIME* } ISO-10646-UCS-4 { IANA } csUCS4 ucs-4 +UTF-32BE { IANA* } UTF32_BigEndian ibm-1232 { IBM* } ibm-1233 { IBM } +UTF-32LE { IANA* } UTF32_LittleEndian ibm-1234 { IBM* } # ICU-specific names for special uses UTF16_PlatformEndian UTF16_OppositeEndian -UTF-32 { IANA* MIME* } ISO-10646-UCS-4 { IANA } csUCS4 ucs-4 -UTF-32BE { IANA* } UTF32_BigEndian ibm-1232 ibm-1233 -UTF-32LE { IANA* } UTF32_LittleEndian ibm-1234 - -# ICU-specific names for special uses UTF32_PlatformEndian UTF32_OppositeEndian @@ -138,7 +155,7 @@ CESU-8 { IANA* } ISO-8859-1 { MIME* IANA } LATIN_1 # Old ICU name - ibm-819 + ibm-819 { IBM* } IBM819 { IANA } cp819 { IANA } latin1 { IANA } @@ -163,6 +180,7 @@ US-ASCII { MIME* IANA } 646 { JAVA } iso-ir-6 { IANA } cp367 { IANA } + # IBM367 { IANA } # Leave this on ibm-367 so it can have an IANA name # Java says "default" too, but that makes no sense. # Partially algorithmic converters @@ -208,12 +226,12 @@ LMBCS-19 # Table-based interchange codepages -ibm-367 IBM367 { IANA* } # This is ASCII, but it has fallbacks +ibm-367 { IBM* } IBM367 { IANA* } # This is ASCII, but it has fallbacks # Central Europe # Standard iso-8859-1, which does not have the Euro update. # See iso-8859-15 (latin9) for the Euro update -ibm-912 iso-8859-2 { MIME* IANA } +ibm-912 { IBM* } iso-8859-2 { MIME* IANA } latin2 { IANA } # ISO8859_2 { JAVA* } # This is really the default for Java and many others. 8859-2 @@ -225,7 +243,7 @@ ibm-912 iso-8859-2 { MIME* IANA } 912 # Maltese Esperanto -ibm-913 iso-8859-3 { MIME* IANA } +ibm-913 { IBM* } iso-8859-3 { MIME* IANA } latin3 { IANA } 8859-3 csISOLatin3 { IANA } @@ -236,7 +254,7 @@ ibm-913 iso-8859-3 { MIME* IANA } 913 # Baltic -ibm-914 iso-8859-4 { MIME* IANA } +ibm-914 { IBM* } iso-8859-4 { MIME* IANA } latin4 { IANA } 8859-4 csISOLatin4 { IANA } @@ -247,7 +265,7 @@ ibm-914 iso-8859-4 { MIME* IANA } 914 # Cyrillic -ibm-915 iso-8859-5 { MIME* IANA } +ibm-915 { IBM* } iso-8859-5 { MIME* IANA } cyrillic { IANA } 8859-5 csISOLatinCyrillic { IANA } @@ -259,7 +277,7 @@ ibm-915 iso-8859-5 { MIME* IANA } # Arabic # ISO_8859-6-E and ISO_8859-6-I are similar to this charset, but they are not the same # -E means explicit. -I means implicit. However those aliases are rarely used. -ibm-1089 iso-8859-6 { MIME* IANA } +ibm-1089 { IBM* } iso-8859-6 { MIME* IANA } arabic { IANA } 8859-6 csISOLatinArabic { IANA } @@ -271,7 +289,7 @@ ibm-1089 iso-8859-6 { MIME* IANA } 1089 # ISO Greek (w/ euro update) -ibm-4909 iso-8859-7 { MIME* IANA } +ibm-4909 { IBM* } iso-8859-7 { MIME* IANA } greek { IANA } greek8 { IANA } elot_928 { IANA } @@ -287,7 +305,7 @@ ibm-813 # Same as 4909 above but without the euro update # hebrew # ISO_8859-8-E and ISO_8859-8-I are similar to this charset, but they are not the same # -E means explicit. -I means implicit. -ibm-916 iso-8859-8 { MIME* IANA } +ibm-916 { IBM* } iso-8859-8 { MIME* IANA } hebrew { IANA } 8859-8 csISOLatinHebrew { IANA } @@ -297,7 +315,7 @@ ibm-916 iso-8859-8 { MIME* IANA } 916 # Turkish -ibm-920 iso-8859-9 { MIME* IANA } +ibm-920 { IBM* } iso-8859-9 { MIME* IANA } ECMA-128 # IANA doesn't have this alias 6/24/2002 latin5 { IANA } 8859-9 @@ -309,7 +327,7 @@ ibm-920 iso-8859-9 { MIME* IANA } 920 # Latin 9 -ibm-923 iso-8859-15 { IANA* MIME* } # IANA only has iso-8859-15 (6/24/2002) +ibm-923 { IBM* } iso-8859-15 { IANA* MIME* } # IANA only has iso-8859-15 (6/24/2002) # ISO8859_15 { JAVA* } # This is really the default for Java and many others. 8859-15 latin9 @@ -320,14 +338,50 @@ ibm-923 iso-8859-15 { IANA* MIME* } # IANA only has iso-8859-15 cp923 923 -ibm-1252 ibm-1004 cp1004 # Windows Latin 1 without Euro -ibm-942_P120-2000 ibm-942_VASCII_VSUB_VPUA ibm-942 ibm-932 ibm-932_VASCII_VSUB_VPUA # Old s_jis ibm-932 added! -ibm-942_P12A-2000 ibm-942_VSUB_VPUA shift_jis78 sjis78 ibm-932_VSUB_VPUA -ibm-943_P130-2000 ibm-943_VASCII_VSUB_VPUA ibm-943 # japanese. Unicode name is \u30b7\u30d5\u30c8\u7b26\u53f7\u5316\u8868\u73fe Iana says that Windows-31J is an extension to csshiftjis ibm-932 removed -ibm-943_P14A-2000 ibm-943_VSUB_VPUA Shift_JIS { MIME* } csWindows31J sjis cp943 cp932 pck ms_kanji csshiftjis windows-31j x-sjis 943 -ibm-949_P110-2000 ibm-949_VASCII_VSUB_VPUA ibm-949 +# Windows Latin 1 without Euro +ibm-1252 { IBM* } # ibm-1004 and cp1004 are different from this mapping table -ibm-949_P11A-2000 + +# CJK encodings + +ibm-942_P120-2000 { UTR22* } + ibm-942 { IBM* } + ibm-942_VASCII_VSUB_VPUA + ibm-932 { IBM } + ibm-932_VASCII_VSUB_VPUA # Old s_jis +ibm-942_P12A-2000 { UTR22* } # The normal mapping + ibm-942 # Leave untagged because this isn't the default + ibm-942_VSUB_VPUA + shift_jis78 + sjis78 + ibm-932_VSUB_VPUA + +ibm-943_P130-2000 { UTR22* } + ibm-943 { IBM* } + ibm-943_VASCII_VSUB_VPUA + Shift_JIS # Leave untagged because this isn't the default + # japanese. Unicode name is \u30b7\u30d5\u30c8\u7b26\u53f7\u5316\u8868\u73fe +ibm-943_P14A-2000 { UTR22* } + ibm-943 # Leave untagged because this isn't the default + ibm-943_VSUB_VPUA + Shift_JIS { IANA* MIME* } + sjis + cp943 + cp932 + pck # Probably SOLARIS + MS_Kanji { IANA } + csShiftJIS { IANA } + windows-31j { IANA } # A further extension of Shift_JIS to include NEC special characters (Row 13) + csWindows31J { IANA } # A further extension of Shift_JIS to include NEC special characters (Row 13) + x-sjis # Probably MIME + 943 + # Iana says that Windows-31J is an extension to csshiftjis ibm-932 +ibm-949_P110-2000 { UTR22* } + ibm-949 { IBM* } + ibm-949_VASCII_VSUB_VPUA + +ibm-949_P11A-2000 { UTR22* } + ibm-949 ibm-949_VSUB_VPUA KS_C_5601-1987 { IANA* } iso-ir-149 { IANA } @@ -341,25 +395,69 @@ ibm-949_P11A-2000 ksc5601_1992 # KSC-5601-1992 ksc5601_1987 # Needed by Java -ibm-1370_P100-2000 ibm-1370 ibm-1370_VSUB_VPUA Big5 { IANA* MIME* } csBig5 x-big5 cp950 950 # Taiwan Big-5 (w/ euro update) -ibm-950 # Taiwan Big-5 (w/o euro update) -ibm-1386_P100-2002 ibm-1386 ibm-1386_VSUB_VPUA gbk { IANA* } cp936 windows-936 ms936 zh_cn # Chinese GBK removed +ibm-1370_P100-2000 { UTR22* } + ibm-1370 { IBM* } + ibm-1370_VSUB_VPUA + Big5 { IANA* MIME* } + csBig5 { IANA } + x-big5 + cp950 + 950 # Taiwan Big-5 (w/ euro update) +ibm-950 { IBM* } # Taiwan Big-5 (w/o euro update) -ibm-33722_P120-2000 ibm-33722_VASCII_VPUA ibm-33722 cp33722 33722 ibm-5050 # Japan EUC with \ <-> Yen mapping -ibm-33722_P12A-2000 ibm-33722_VPUA EUC-JP { MIME* } ibm-eucJP eucjis Extended_UNIX_Code_Packed_Format_for_Japanese { IANA* } cseucpkdfmtjapanese X-EUC-JP # Japan EUC. x-euc-jp is a MIME name -ibm-970_P110-2000 ibm-970 ibm-970_VPUA EUC-KR { IANA* MIME* } ibm-eucKR csEUCKR # Korean EUC. x-euc-kr is a MIME name -ibm-964_P110-2000 ibm-964 ibm-964_VPUA EUC-TW ibm-eucTW cns11643 # Taiwan EUC. x-euc-tw is a MIME name +ibm-1386_P100-2002 { UTR22* } + ibm-1386 { IBM* } + ibm-1386_VSUB_VPUA + GBK { IANA* } + CP936 { IANA } + windows-936 { IANA } + MS936 { IANA } + zh_cn # Chinese GBK removed -ibm-1363_P110-2000 ibm-1363 ibm-1363_VASCII_VSUB_VPUA ibm-1362 # Korean KSC Korean Windows MBCS +ibm-33722_P120-2000 { UTR22* } # Japan EUC with \ <-> Yen mapping + ibm-33722 { IBM* } + ibm-33722_VASCII_VPUA + cp33722 + 33722 + ibm-5050 +ibm-33722_P12A-2000 { UTR22* } + ibm-33722 # Leave untagged because this isn't the default + ibm-33722_VPUA + EUC-JP { IANA MIME* } + ibm-eucJP + eucjis + Extended_UNIX_Code_Packed_Format_for_Japanese { IANA* } + csEUCPkdFmtJapanese { IANA } + X-EUC-JP # Japan EUC. x-euc-jp is a MIME name +ibm-970_P110-2000 { UTR22* } + ibm-970 { IBM* } + ibm-970_VPUA + EUC-KR { IANA* MIME* } + ibm-eucKR + csEUCKR { IANA } # Korean EUC. x-euc-kr is a MIME name +ibm-964_P110-2000 { UTR22* } + ibm-964 { IBM* } + ibm-964_VPUA + EUC-TW + ibm-eucTW + cns11643 # Taiwan EUC. x-euc-tw is a MIME name -ibm-1363_P11B-2000 ibm-1363_VSUB_VPUA +ibm-1363_P110-2000 { UTR22* } # Korean KSC Korean Windows MBCS + ibm-1363 { IBM* } + ibm-1363_VASCII_VSUB_VPUA + # ibm-1362 { IBM } # ibm-1362 is a DBCS codepage, not MBCS + +ibm-1363_P11B-2000 { UTR22* } + ibm-1363 # Leave untagged because this isn't the default + ibm-1363_VSUB_VPUA windows-949 cp949 cp1363 ksc # korean # The korean alias from IANA goes to ibm-949_P11A-2000 -ibm-1383_P110-2000 ibm-1383_VPUA +ibm-1383_P110-2000 { UTR22* } + ibm-1383_VPUA ibm-1383 EUC-CN ibm-eucCN @@ -374,89 +472,89 @@ ibm-1383_P110-2000 ibm-1383_VPUA 1383 csGB2312 # China EUC. x-euc-cn is a MIME name -ibm-1162 tis-620 { IANA* } cp874 windows-874 ms874 cp9066 874 # Thai (w/ euro update) -ibm-874 ibm-1161 # Same as 1162 (w/o euro update) +ibm-1162 { IBM* } TIS-620 { IANA* } cp874 windows-874 ms874 cp9066 874 # Thai (w/ euro update) +ibm-874 { IBM* } ibm-1161 # Same as 1162 (w/o euro update) # Platform codepages -ibm-437 cp437 csPC8CodePage437 437 # PC US -ibm-850 IBM850 { IANA* } cp850 { MIME* } 850 csPC850Multilingual # PC latin1 -ibm-851 IBM851 { IANA* } cp851 { MIME* } 851 csPC851 # PC DOS Greek (w/o euro) -ibm-858 cp858 { MIME* } IBM00858 { IANA* } # PC latin1 with Euro cp850 removed -ibm-9044 852 csPCp852 cp852 # PC latin2 (w/ euro update) cp852 is a MIME name for IBM-852 -ibm-852 IBM852 { IANA* } # PC latin2 (w/o euro update) -ibm-872 855 csIBM855 cp855 csPCp855 # PC cyrillic (w/ euro update) cp855 is a MIME name for IBM-855 -ibm-855 IBM855 { IANA* } # PC cyrillic (w/o euro update) -ibm-856 cp856 { MIME* } 856 # PC Hebrew (old) -ibm-9049 857 csIBM857 cp857 { MIME* } # PC Latin 5 (Turkish) (w/ euro update) -ibm-857 IBM857 { IANA* } # PC Latin 5 (w/o euro update) -ibm-859 cp859 { MIME* } # PC Latin 9 (w/ euro update) -ibm-860 IBM860 { IANA* } cp860 { MIME* } 860 csIBM860 # PC Portugal -ibm-861 IBM861 { IANA* } cp861 { MIME* } 861 cp-is csIBM861 # PC Iceland -ibm-867 cp867 862 cp862 { MIME* } cspc862latinhebrew # PC Hebrew (w/ euro update) -ibm-862 IBM862 { IANA* } # PC Hebrew (w/o euro update) -ibm-863 IBM863 { IANA* } cp863 { MIME* } 863 csIBM863 # PC Canadian French -ibm-17248 cp864 { MIME* } csIBM864 # PC Arabic (w/ euro update) -ibm-864 IBM864 { IANA* } # PC Arabic (w/o euro update) -ibm-865 IBM865 { IANA* } cp865 { MIME* } 865 csIBM865 # PC Nordic -ibm-808 cp866 { MIME* } 866 csIBM866 # PC Russian (w/ euro update) -ibm-866 # PC Russian (w/o euro update) -ibm-868 IBM868 { IANA* } cp868 { MIME* } cp-ar csIBM868 868 # PC Urdu -ibm-9061 cp869 { MIME* } 869 cp-gr csIBM869 # PC Greek (w/ euro update) -ibm-869 IBM869 { IANA* } # PC Greek (w/o euro update) -ibm-878 KOI8-R { IANA* MIME* } cp878 koi8 cskoi8r # Russian internet -ibm-901 cp921 { MIME* } 921 # PC Baltic (w/ euro update) -ibm-921 # PC Baltic (w/o euro update) -ibm-902 cp922 { MIME* } 922 # PC Estonian (w/ euro update) -ibm-922 # PC Estonian (w/o euro update) +ibm-437 { IBM* } cp437 csPC8CodePage437 437 # PC US +ibm-850 { IBM* } IBM850 { IANA* } cp850 { MIME* } 850 csPC850Multilingual # PC latin1 +ibm-851 { IBM* } IBM851 { IANA* } cp851 { MIME* } 851 csPC851 # PC DOS Greek (w/o euro) +ibm-858 { IBM* } cp858 { MIME* } IBM00858 { IANA* } # PC latin1 with Euro cp850 removed +ibm-9044 { IBM* } 852 csPCp852 cp852 # PC latin2 (w/ euro update) cp852 is a MIME name for IBM-852 +ibm-852 { IBM* } IBM852 { IANA* } # PC latin2 (w/o euro update) +ibm-872 { IBM* } 855 csIBM855 cp855 csPCp855 # PC cyrillic (w/ euro update) cp855 is a MIME name for IBM-855 +ibm-855 { IBM* } IBM855 { IANA* } # PC cyrillic (w/o euro update) +ibm-856 { IBM* } cp856 { MIME* } 856 # PC Hebrew (old) +ibm-9049 { IBM* } 857 csIBM857 cp857 { MIME* } # PC Latin 5 (Turkish) (w/ euro update) +ibm-857 { IBM* } IBM857 { IANA* } # PC Latin 5 (w/o euro update) +ibm-859 { IBM* } cp859 { MIME* } # PC Latin 9 (w/ euro update) +ibm-860 { IBM* } IBM860 { IANA* } cp860 { MIME* } 860 csIBM860 # PC Portugal +ibm-861 { IBM* } IBM861 { IANA* } cp861 { MIME* } 861 cp-is csIBM861 # PC Iceland +ibm-867 { IBM* } cp867 862 cp862 { MIME* } cspc862latinhebrew # PC Hebrew (w/ euro update) +ibm-862 { IBM* } IBM862 { IANA* } # PC Hebrew (w/o euro update) +ibm-863 { IBM* } IBM863 { IANA* } cp863 { MIME* } 863 csIBM863 # PC Canadian French +ibm-17248 { IBM* } cp864 { MIME* } csIBM864 # PC Arabic (w/ euro update) +ibm-864 { IBM* } IBM864 { IANA* } # PC Arabic (w/o euro update) +ibm-865 { IBM* } IBM865 { IANA* } cp865 { MIME* } 865 csIBM865 # PC Nordic +ibm-808 { IBM* } cp866 { MIME* } 866 csIBM866 # PC Russian (w/ euro update) +ibm-866 { IBM* } # PC Russian (w/o euro update) +ibm-868 { IBM* } IBM868 { IANA* } cp868 { MIME* } cp-ar csIBM868 868 # PC Urdu +ibm-9061 { IBM* } cp869 { MIME* } 869 cp-gr csIBM869 # PC Greek (w/ euro update) +ibm-869 { IBM* } IBM869 { IANA* } # PC Greek (w/o euro update) +ibm-878 { IBM* } KOI8-R { IANA* MIME* } cp878 koi8 cskoi8r # Russian internet +ibm-901 { IBM* } cp921 { MIME* } 921 # PC Baltic (w/ euro update) +ibm-921 { IBM* } # PC Baltic (w/o euro update) +ibm-902 { IBM* } cp922 { MIME* } 922 # PC Estonian (w/ euro update) +ibm-922 { IBM* } # PC Estonian (w/o euro update) # ibm-941 jis-208 jisx-208 # Pure DBCS jisx-208 # ibm-941 is not JISX 208 code page -ibm-5346 windows-1250 { IANA* } cp1250 # Windows Latin2 (w/ euro update) -ibm-5347 windows-1251 { IANA* } cp1251 # Windows Cyrillic (w/ euro update) -ibm-5348 windows-1252 { IANA* } cp1252 # Windows Latin1 (w/ euro update) -ibm-5349 windows-1253 { IANA* } cp1253 # Windows Greek (w/ euro update) -ibm-5350 windows-1254 { IANA* } cp1254 # Windows Turkish (w/ euro update) -ibm-5351 windows-1255 { IANA* } cp1255 # Windows Hebrew (w/ euro update) -ibm-5352 windows-1256 { IANA* } cp1256 # Windows Arabic (w/ euro update) -ibm-5353 windows-1257 { IANA* } cp1257 # Windows Baltic (w/ euro update) -ibm-5354 windows-1258 { IANA* } cp1258 # Windows Vietnamese (w/ euro update) -ibm-1250 # Windows Latin2 (w/o euro update) -ibm-1251 # Windows Cyrillic (w/o euro update) -ibm-1253 # Windows Greek (w/o euro update) -ibm-1254 # Windows Turkish (w/o euro update) -ibm-1255 # Windows Hebrew (w/o euro update) -ibm-1256 # Windows Arabic (w/o euro update) -ibm-1257 # Windows Baltic (w/o euro update) -ibm-1258 # Windows Vietnamese (w/o euro update) +ibm-5346 { IBM* } windows-1250 { IANA* } cp1250 # Windows Latin2 (w/ euro update) +ibm-5347 { IBM* } windows-1251 { IANA* } cp1251 # Windows Cyrillic (w/ euro update) +ibm-5348 { IBM* } windows-1252 { IANA* } cp1252 # Windows Latin1 (w/ euro update) +ibm-5349 { IBM* } windows-1253 { IANA* } cp1253 # Windows Greek (w/ euro update) +ibm-5350 { IBM* } windows-1254 { IANA* } cp1254 # Windows Turkish (w/ euro update) +ibm-5351 { IBM* } windows-1255 { IANA* } cp1255 # Windows Hebrew (w/ euro update) +ibm-5352 { IBM* } windows-1256 { IANA* } cp1256 # Windows Arabic (w/ euro update) +ibm-5353 { IBM* } windows-1257 { IANA* } cp1257 # Windows Baltic (w/ euro update) +ibm-5354 { IBM* } windows-1258 { IANA* } cp1258 # Windows Vietnamese (w/ euro update) +ibm-1250 { IBM* } # Windows Latin2 (w/o euro update) +ibm-1251 { IBM* } # Windows Cyrillic (w/o euro update) +ibm-1253 { IBM* } # Windows Greek (w/o euro update) +ibm-1254 { IBM* } # Windows Turkish (w/o euro update) +ibm-1255 { IBM* } # Windows Hebrew (w/o euro update) +ibm-1256 { IBM* } # Windows Arabic (w/o euro update) +ibm-1257 { IBM* } # Windows Baltic (w/o euro update) +ibm-1258 { IBM* } # Windows Vietnamese (w/o euro update) -ibm-1275 macintosh { IANA* } mac { MIME* } csMacintosh # Apple latin 1 -ibm-1276 Adobe-Standard-Encoding { IANA* } csAdobeStandardEncoding # Different from ISO-Unicode-IBM-1276 (GCSGID: 1276) -ibm-1277 Adobe-Latin1-Encoding -ibm-1280 macgr # Apple Greek -ibm-1281 mactr # Apple Turkish -ibm-1282 macce # Apple Central Europe -ibm-1283 maccy # Apple Cyrillic +ibm-1275 { IBM* } macintosh { IANA* } mac { IANA MIME* } csMacintosh { IANA } # Apple latin 1 +ibm-1276 { IBM* } Adobe-Standard-Encoding { IANA* } csAdobeStandardEncoding { IANA } # Different from ISO-Unicode-IBM-1276 (GCSGID: 1276) +ibm-1277 { IBM* } Adobe-Latin1-Encoding +ibm-1280 { IBM* } macgr # Apple Greek +ibm-1281 { IBM* } mactr # Apple Turkish +ibm-1282 { IBM* } macce # Apple Central Europe +ibm-1283 { IBM* } maccy # Apple Cyrillic -ibm-1051 hp-roman8 { IANA* } roman8 r8 csHPRoman8 # HP Latin1 +ibm-1051 { IBM* } hp-roman8 { IANA* } roman8 r8 csHPRoman8 # HP Latin1 -ibm-806_P100-2000 ibm-806 ibm-806_VSUB # PC ISCII-91: Indian Script Code -ibm-1006_P100-2000 ibm-1006 ibm-1006_VPUA # Urdu -ibm-1006_X100-2000 ibm-1006_STD # Urdu -ibm-1098_P100-2000 ibm-1098 ibm-1098_VSUB_VPUA # Farsi -ibm-1098_X100-2000 ibm-1098_VSUB # Farsi -ibm-1124_P100-2000 ibm-1124 ibm-1124_STD # ISO Cyrillic Ukraine -ibm-1125_P100-2000 ibm-1125 ibm-1125_VSUB # Cyrillic Ukraine PC -ibm-1129_P100-2000 ibm-1129 ibm-1129_STD # ISO Vietnamese -ibm-1131_P100-2000 ibm-1131 ibm-1131_VSUB # Cyrillic Belarus PC -ibm-1133_P100-2000 ibm-1133 ibm-1133_STD # ISO Lao -ibm-1381_P110-2000 ibm-1381 ibm-1381_VSUB_VPUA # S-Ch PC Data mixed (IBM GB) -ibm-9066_P100-2000 ibm-9066 ibm-9066_VSUB # Thai PC +ibm-806_P100-2000 { UTR22* } ibm-806 { IBM* } ibm-806_VSUB # PC ISCII-91: Indian Script Code +ibm-1006_P100-2000 { UTR22* } ibm-1006 { IBM* } ibm-1006_VPUA # Urdu +ibm-1006_X100-2000 { UTR22* } ibm-1006_STD # Urdu +ibm-1098_P100-2000 { UTR22* } ibm-1098 { IBM* } ibm-1098_VSUB_VPUA # Farsi +ibm-1098_X100-2000 { UTR22* } ibm-1098_VSUB # Farsi +ibm-1124_P100-2000 { UTR22* } ibm-1124 { IBM* } ibm-1124_STD # ISO Cyrillic Ukraine +ibm-1125_P100-2000 { UTR22* } ibm-1125 { IBM* } ibm-1125_VSUB # Cyrillic Ukraine PC +ibm-1129_P100-2000 { UTR22* } ibm-112 { IBM* }9 ibm-1129_STD # ISO Vietnamese +ibm-1131_P100-2000 { UTR22* } ibm-1131 { IBM* } ibm-1131_VSUB # Cyrillic Belarus PC +ibm-1133_P100-2000 { UTR22* } ibm-1133 { IBM* } ibm-1133_STD # ISO Lao +ibm-1381_P110-2000 { UTR22* } ibm-1381 { IBM* } ibm-1381_VSUB_VPUA # S-Ch PC Data mixed (IBM GB) +ibm-9066_P100-2000 { UTR22* } ibm-9066 { IBM* } ibm-9066_VSUB # Thai PC # Added for more euro support -ibm-849 cp1131 # PC Belarus (w/ euro update) -ibm-848 cp1125 # PC Ukraine (w/ euro update) -ibm-5104 cp1008 # 8-bit Arabic (w/ euro update) -ibm-9238 cp1046 # PC Arabic Extended (w/ euro update) +ibm-849 { IBM* } cp1131 # PC Belarus (w/ euro update) +ibm-848 { IBM* } cp1125 # PC Ukraine (w/ euro update) +ibm-5104 { IBM* } cp1008 # 8-bit Arabic (w/ euro update) +ibm-9238 { IBM* } cp1046 # PC Arabic Extended (w/ euro update) # ibm-5210 cp1114 # PC SBCS Big-5 (w/ euro update) # ibm-21427 cp947 # PC DBCS Big-5 (w/ euro update) @@ -465,77 +563,87 @@ ibm-9238 cp1046 # PC Arabic Extended (w/ euro update # EBCDIC codepages according to the CDRA # without Euro -ibm-37 IBM037 { IANA* } ibm-037 cpibm37 ebcdic-cp-us ebcdic-cp-ca ebcdic-cp-wt ebcdic-cp-nl csIBM037 cp37 cp037 037 # EBCDIC US -ibm-273 IBM273 { IANA* } csIBM273 ebcdic-de cp273 cpibm273 273 # EBCDIC Germanay, Austria -ibm-277 IBM277 { IANA* } EBCDIC-CP-DK EBCDIC-CP-NO csIBM277 ebcdic-dk cp277 cpibm277 277 # EBCDIC Denmark -ibm-278 IBM278 { IANA* } ebcdic-cp-fi ebcdic-cp-se csIBM278 ebcdic-sv cp278 cpibm278 278 # EBCDIC Sweden -ibm-280 IBM280 { IANA* } ebcdic-cp-it csIBM280 cp280 cpibm280 280 # EBCDIC Italy -ibm-284 IBM284 { IANA* } ebcdic-cp-es csIBM284 cp284 cpibm284 284 # EBCDIC Spain -ibm-285 IBM285 { IANA* } ebcdic-cp-gb csIBM285 ebcdic-gb cp285 cpibm285 285 # EBCDIC UK Ireland -ibm-290 IBM290 { IANA* } EBCDIC-JP-kana csIBM290 cp290 # host SBCS (Katakana) -ibm-297 IBM297 { IANA* } ebcdic-cp-fr csIBM297 cp297 cpibm297 297 # EBCDIC France -ibm-420 IBM420 { IANA* } ebcdic-cp-ar1 csIBM420 cp420 420 -ibm-424 IBM424 { IANA* } ebcdic-cp-he csIBM424 cp424 424 -ibm-500 IBM500 { IANA* } cpibm500 csIBM500 cp500 ebcdic-cp-be ebcdic-cp-ch 500 # EBCDIC International Latin1 -ibm-803 cp803 # Old EBCDIC Hebrew +ibm-37 { IBM* } IBM037 { IANA* } # EBCDIC US + ibm-037 + cpibm37 + ebcdic-cp-us { IANA } + ebcdic-cp-ca { IANA } + ebcdic-cp-wt { IANA } + ebcdic-cp-nl { IANA } + csIBM037 { IANA } + cp37 + cp037 + 037 +ibm-273 { IBM* } IBM273 { IANA* } csIBM273 { IANA } ebcdic-de CP273 { IANA } cpibm273 273 # EBCDIC Germanay, Austria +ibm-277 { IBM* } IBM277 { IANA* } EBCDIC-CP-DK { IANA } EBCDIC-CP-NO { IANA } csIBM277 { IANA } ebcdic-dk cp277 cpibm277 277 # EBCDIC Denmark +ibm-278 { IBM* } IBM278 { IANA* } ebcdic-cp-fi { IANA } ebcdic-cp-se { IANA } csIBM278 { IANA } ebcdic-sv cp278 cpibm278 278 # EBCDIC Sweden +ibm-280 { IBM* } IBM280 { IANA* } ebcdic-cp-it { IANA } csIBM280 { IANA } CP280 { IANA } cpibm280 280 # EBCDIC Italy +ibm-284 { IBM* } IBM284 { IANA* } ebcdic-cp-es { IANA } csIBM284 { IANA } CP284 { IANA } cpibm284 284 # EBCDIC Spain +ibm-285 { IBM* } IBM285 { IANA* } ebcdic-cp-gb { IANA } csIBM285 { IANA } CP285 { IANA } ebcdic-gb cpibm285 285 # EBCDIC UK Ireland +ibm-290 { IBM* } IBM290 { IANA* } EBCDIC-JP-kana { IANA } csIBM290 { IANA } cp290 { IANA } # host SBCS (Katakana) +ibm-297 { IBM* } IBM297 { IANA* } ebcdic-cp-fr { IANA } csIBM297 { IANA } cp297 { IANA } cpibm297 297 # EBCDIC France +ibm-420 { IBM* } IBM420 { IANA* } ebcdic-cp-ar1 { IANA } csIBM420 { IANA } cp420 { IANA } 420 +ibm-424 { IBM* } IBM424 { IANA* } ebcdic-cp-he { IANA } csIBM424 { IANA } cp424 { IANA } 424 +ibm-500 { IBM* } IBM500 { IANA* } cpibm500 csIBM500 { IANA } CP500 { IANA } ebcdic-cp-be { IANA } ebcdic-cp-ch { IANA } 500 # EBCDIC International Latin1 +ibm-803 { IBM* } cp803 # Old EBCDIC Hebrew #ibm-834 cp834 # Korean DBCS Host (ibm-933 is the mixed host version of this codepage) #ibm-835 cp835 # DBCS T-Ch Host (ibm-9027 is the Euro update of this codepage) -ibm-870_P100-2000 IBM870 { IANA* } ibm-870 CP870 ibm-870_STD ebcdic-cp-roece ebcdic-cp-yu csIBM870 -ibm-871 IBM871 { IANA* } ebcdic-cp-is csIBM871 cpibm871 cp871 871 # EBCDIC Iceland -ibm-875_P100-2000 ibm-875 cp875 875 ibm-875_STD -ibm-918_P100-2000 IBM918 { IANA* } ibm-918 CP918 ibm-918_VPUA ebcdic-cp-ar2 csIBM918 -ibm-918_X100-2000 ibm-918_STD -ibm-930 cp930 cpibm930 930 #ibm-5026 # EBCDIC_STATEFUL Katakana-Kanji Host Mixed. ibm-930 =? ibm-5026 -ibm-933 cp933 cpibm933 933 # Korea EBCDIC MIXED -ibm-935 cp935 cpibm935 935 # China EBCDIC MIXED -ibm-937 cp937 cpibm937 937 # Taiwan EBCDIC MIXED -ibm-939 cp939 939 #ibm-5035 # EBCDIC_STATEFUL Latin-Kanji Host Mixed. ibm-939 =? ibm-5035 -ibm-1025_P100-2000 ibm-1025 ibm-1025_STD -ibm-1026_P100-2000 IBM1026 { IANA* } ibm-1026 CP1026 csIBM1026 ibm-1026_STD +ibm-870_P100-2000 { UTR22* } IBM870 { IANA* } ibm-870 { IBM* } CP870 { IANA } ibm-870_STD ebcdic-cp-roece { IANA } ebcdic-cp-yu { IANA } csIBM870 { IANA } +ibm-871 { IBM* } IBM871 { IANA* } ebcdic-cp-is { IANA } csIBM871 { IANA } ebcdic-is cpibm871 CP871 { IANA } 871 # EBCDIC Iceland +ibm-875_P100-2000 { UTR22* } ibm-875 { IBM* } cp875 875 ibm-875_STD +ibm-918_P100-2000 { UTR22* } IBM918 { IANA* } ibm-918 { IBM* } CP918 { IANA } ibm-918_VPUA ebcdic-cp-ar2 { IANA } csIBM918 { IANA } +ibm-918_X100-2000 { UTR22* } ibm-918_STD +ibm-930 { IBM* } cp930 cpibm930 930 #ibm-5026 # EBCDIC_STATEFUL Katakana-Kanji Host Mixed. ibm-930 =? ibm-5026 +ibm-933 { IBM* } cp933 cpibm933 933 # Korea EBCDIC MIXED +ibm-935 { IBM* } cp935 cpibm935 935 # China EBCDIC MIXED +ibm-937 { IBM* } cp937 cpibm937 937 # Taiwan EBCDIC MIXED +ibm-939 { IBM* } cp939 939 #ibm-5035 # EBCDIC_STATEFUL Latin-Kanji Host Mixed. ibm-939 =? ibm-5035 +ibm-1025_P100-2000 { UTR22* } ibm-1025 { IBM* } ibm-1025_STD +ibm-1026_P100-2000 { UTR22* } IBM1026 { IANA* } ibm-1026 { IBM* } CP1026 { IANA } csIBM1026 { IANA } ibm-1026_STD ibm-1047 cpibm1047 # EBCDIC Open systems Latin1 -ibm-1097_P100-2000 ibm-1097 ibm-1097_VPUA -ibm-1097_X100-2000 ibm-1097_STD -ibm-1112_P100-2000 ibm-1112 cp1112 1112 ibm-1112_STD -ibm-1122_P100-2000 ibm-1122 cp1122 1122 ibm-1122_STD -ibm-1130_P100-2000 ibm-1130 ibm-1130_STD -ibm-1132_P100-2000 ibm-1132 ibm-1132_STD -ibm-1137_P100-2000 ibm-1137 ibm-1137_STD -ibm-1388_P103-2001 ibm-1388 # S-Ch DBCS-Host Data GBK mixed MBCS -ibm-9030_P100-2000 ibm-9030 ibm-9030_STD +ibm-1097_P100-2000 { UTR22* } ibm-1097 { IBM* } ibm-1097_VPUA +ibm-1097_X100-2000 { UTR22* } ibm-1097_STD +ibm-1112_P100-2000 { UTR22* } ibm-1112 { IBM* } cp1112 1112 ibm-1112_STD +ibm-1122_P100-2000 { UTR22* } ibm-1122 { IBM* } cp1122 1122 ibm-1122_STD +ibm-1130_P100-2000 { UTR22* } ibm-1130 { IBM* } ibm-1130_STD +ibm-1132_P100-2000 { UTR22* } ibm-1132 { IBM* } ibm-1132_STD +ibm-1137_P100-2000 { UTR22* } ibm-1137 { IBM* } ibm-1137_STD +ibm-1388_P103-2001 { UTR22* } ibm-1388 { IBM* } # S-Ch DBCS-Host Data GBK mixed MBCS +ibm-9030_P100-2000 { UTR22* } ibm-9030 { IBM* } ibm-9030_STD # with Euro -ibm-1123 cpibm1123 # EBCDIC Cyrillic Ukraine -ibm-1140 cpibm1140 IBM01140 { IANA* } # EBCDIC US -ibm-1141 cpibm1141 IBM01141 { IANA* } # EBCDIC Germanay, Austria -ibm-1142 cpibm1142 IBM01142 { IANA* } # EBCDIC Denmark -ibm-1143 cpibm1143 IBM01143 { IANA* } # EBCDIC Sweden -ibm-1144 cpibm1144 # EBCDIC Italy -ibm-1145 cpibm1145 # EBCDIC Spain -ibm-1146 cpibm1146 # EBCDIC UK Ireland -ibm-1147 cpibm1147 # EBCDIC France -ibm-1148 cpibm1148 # EBCDIC International Latin1 -ibm-1149 cpibm1149 ebcdic-is # EBCDIC Iceland -ibm-1153 cpibm1153 # EBCDIC latin 2 -ibm-1154 cp1025 cpibm1154 # EBCDIC Cyrillic Multilingual -ibm-1155 cpibm1155 # EBCDIC Turkey -ibm-1156 cpibm1156 # EBCDIC Baltic Multilingual -ibm-1157 cpibm1157 # EBCDIC Estonia -ibm-1158 cp1123 cpibm1158 1123 # EBCDIC Cyrillic Ukraine -ibm-1159 cp28709 # SBCS T-Ch Host -ibm-1160 cp9030 cpibm1160 # EBCDIC Thailand -ibm-1164 cp1130 cpibm1164 # EBCDIC Viet Nam -ibm-1364_P110-2000 ibm-1364 ibm-1364_VPUA cp1364 # Korean Host Mixed -ibm-1371 cpibm1371 # Taiwan EBCDIC MIXED -ibm-1390 cpibm1390 # Japan EBCDIC MIXED -ibm-1399 # Host MBCS (Latin-Kanji) -ibm-4899 cpibm4899 # Old EBCDIC Hebrew -ibm-4971 cpibm4971 # EBCDIC Greek -ibm-5123 cp1027 # Host Roman Jis -ibm-8482 # host SBCS (Katakana) -ibm-9027 # DBCS T-Ch Host (simlar to ibm-835) -ibm-12712 cpibm12712 ebcdic-he # EBCDIC Hebrew (new sheqel, control charaters update) -ibm-16684 cp300 # DBCS Jis + Roman Jis Host -ibm-16804 cpibm16804 ebcdic-ar # EBCDIC Arabic +ibm-1123 { IBM* } cpibm1123 # EBCDIC Cyrillic Ukraine +ibm-1140 { IBM* } cpibm1140 IBM01140 { IANA* } CCSID01140 { IANA } CP01140 { IANA } ebcdic-us-37+euro { IANA } # EBCDIC US +ibm-1141 { IBM* } cpibm1141 IBM01141 { IANA* } CCSID01141 { IANA } CP01141 { IANA } ebcdic-de-273+euro { IANA } # EBCDIC Germanay, Austria +ibm-1142 { IBM* } cpibm1142 IBM01142 { IANA* } CCSID01142 { IANA } CP01142 { IANA } ebcdic-dk-277+euro { IANA } ebcdic-no-277+euro { IANA } # EBCDIC Denmark +ibm-1143 { IBM* } cpibm1143 IBM01143 { IANA* } CCSID01143 { IANA } CP01143 { IANA } ebcdic-fi-278+euro { IANA } ebcdic-se-278+euro { IANA } # EBCDIC Sweden +ibm-1144 { IBM* } cpibm1144 IBM01144 { IANA* } CCSID01144 { IANA } CP01144 { IANA } ebcdic-it-280+euro { IANA } # EBCDIC Italy +ibm-1145 { IBM* } cpibm1145 IBM01145 { IANA* } CCSID01145 { IANA } CP01145 { IANA } ebcdic-es-284+euro { IANA } # EBCDIC Spain +ibm-1146 { IBM* } cpibm1146 IBM01146 { IANA* } CCSID01146 { IANA } CP01146 { IANA } ebcdic-gb-285+euro { IANA } # EBCDIC UK Ireland +ibm-1147 { IBM* } cpibm1147 IBM01147 { IANA* } CCSID01147 { IANA } CP01147 { IANA } ebcdic-fr-297+euro { IANA } # EBCDIC France +ibm-1148 { IBM* } cpibm1148 IBM01148 { IANA* } CCSID01148 { IANA } CP01148 { IANA } ebcdic-international-500+euro { IANA } # EBCDIC International Latin1 +ibm-1149 { IBM* } cpibm1149 IBM01149 { IANA* } CCSID01149 { IANA } CP01149 { IANA } ebcdic-is-871+euro { IANA } # EBCDIC Iceland +ibm-1153 { IBM* } cpibm1153 # EBCDIC latin 2 +ibm-1154 { IBM* } cp1025 cpibm1154 # EBCDIC Cyrillic Multilingual +ibm-1155 { IBM* } cpibm1155 # EBCDIC Turkey +ibm-1156 { IBM* } cpibm1156 # EBCDIC Baltic Multilingual +ibm-1157 { IBM* } cpibm1157 # EBCDIC Estonia +ibm-1158 { IBM* } cp1123 cpibm1158 1123 # EBCDIC Cyrillic Ukraine +ibm-1159 { IBM* } cp28709 # SBCS T-Ch Host +ibm-1160 { IBM* } cp9030 cpibm1160 # EBCDIC Thailand +ibm-1164 { IBM* } cp1130 cpibm1164 # EBCDIC Viet Nam +ibm-1364_P110-2000 { UTR22* } ibm-1364 { IBM* } ibm-1364_VPUA cp1364 # Korean Host Mixed +ibm-1371 { IBM* } cpibm1371 # Taiwan EBCDIC MIXED +ibm-1390 { IBM* } cpibm1390 # Japan EBCDIC MIXED +ibm-1399 { IBM* } # Host MBCS (Latin-Kanji) +ibm-4899 { IBM* } cpibm4899 # Old EBCDIC Hebrew +ibm-4971 { IBM* } cpibm4971 # EBCDIC Greek +ibm-5123 { IBM* } cp1027 # Host Roman Jis +ibm-8482 { IBM* } # host SBCS (Katakana) +ibm-9027 { IBM* } # DBCS T-Ch Host (simlar to ibm-835) +ibm-12712 { IBM* } cpibm12712 ebcdic-he # EBCDIC Hebrew (new sheqel, control charaters update) +ibm-16684 { IBM* } cp300 # DBCS Jis + Roman Jis Host +ibm-16804 { IBM* } cpibm16804 ebcdic-ar # EBCDIC Arabic # unsupported IANA names # ebcdic-it csEBCDICIT @@ -547,21 +655,21 @@ ibm-16804 cpibm16804 ebcdic-ar # EBCDIC Arabic # EBCDIC codepages for S/390, with LF and NL codes swapped # without Euro -ibm-37-s390 ibm037-s390 # EBCDIC US -ibm-1047-s390 # EBCDIC for S/390 Open Edition +ibm-37-s390 { UTR22* } ibm037-s390 # EBCDIC US +ibm-1047-s390 { UTR22* } # EBCDIC for S/390 Open Edition # with Euro -ibm-1140-s390 # EBCDIC US -ebcdic-xml-us # Yet another form of ibm-1140 -ibm-1142-s390 # EBCDIC Denmark -ibm-1143-s390 # EBCDIC Sweden -ibm-1144-s390 # EBCDIC Italy -ibm-1145-s390 # EBCDIC Spain -ibm-1146-s390 # EBCDIC UK Ireland -ibm-1147-s390 # EBCDIC France -ibm-1148-s390 # EBCDIC International Latin1 -ibm-1149-s390 # EBCDIC Iceland -ibm-1153-s390 # EBCDIC latin 2 -ibm-12712-s390 # EBCDIC Hebrew -ibm-16804-s390 # EBCDIC Arabic +ibm-1140-s390 { UTR22* } # EBCDIC US +ebcdic-xml-us # Yet another form of ibm-1140 +ibm-1142-s390 { UTR22* } # EBCDIC Denmark +ibm-1143-s390 { UTR22* } # EBCDIC Sweden +ibm-1144-s390 { UTR22* } # EBCDIC Italy +ibm-1145-s390 { UTR22* } # EBCDIC Spain +ibm-1146-s390 { UTR22* } # EBCDIC UK Ireland +ibm-1147-s390 { UTR22* } # EBCDIC France +ibm-1148-s390 { UTR22* } # EBCDIC International Latin1 +ibm-1149-s390 { UTR22* } # EBCDIC Iceland +ibm-1153-s390 { UTR22* } # EBCDIC latin 2 +ibm-12712-s390 { UTR22* } # EBCDIC Hebrew +ibm-16804-s390 { UTR22* } # EBCDIC Arabic diff --git a/icu4c/source/test/cintltst/ccapitst.c b/icu4c/source/test/cintltst/ccapitst.c index 7730d827139..4a67ff7f951 100644 --- a/icu4c/source/test/cintltst/ccapitst.c +++ b/icu4c/source/test/cintltst/ccapitst.c @@ -1048,12 +1048,18 @@ static void TestAlias() { alias0 = ucnv_getAlias(name, 0, &status); for (j=1; j " "alias[%d]=NULL\n", @@ -1072,10 +1078,15 @@ static void TestAlias() { } if (0 != uprv_strcmp(alias0, mapBack)) { - log_err("FAIL: Converter \"%s\" -> " - "alias[%d]=\"%s\" -> " - "alias[0]=\"%s\", exp. \"%s\"\n", - name, j, alias, mapBack, alias0); + if (status != U_AMBIGUOUS_ALIAS_WARNING) { + log_err("FAIL: Converter \"%s\" -> " + "alias[%d]=\"%s\" -> " + "alias[0]=\"%s\", exp. \"%s\"\n", + name, j, alias, mapBack, alias0); + } + else { + ucnv_getAlias(mapBack, 0, &status); + } } } } diff --git a/icu4c/source/test/cintltst/ncnvfbts.c b/icu4c/source/test/cintltst/ncnvfbts.c index a4ff3ae321a..2774f46bdc3 100644 --- a/icu4c/source/test/cintltst/ncnvfbts.c +++ b/icu4c/source/test/cintltst/ncnvfbts.c @@ -124,7 +124,7 @@ static void setNuConvTestName(const char *codepage, const char *direction) static UBool testConvertFromUnicode(const UChar *source, int sourceLen, const uint8_t *expect, int expectLen, - const char *codepage, UBool fallback, int32_t *expectOffsets) + const char *codepage, UBool fallback, const int32_t *expectOffsets) { @@ -287,7 +287,7 @@ static UBool testConvertFromUnicode(const UChar *source, int sourceLen, const u } static UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *expect, int expectlen, - const char *codepage, UBool fallback, int32_t *expectOffsets) + const char *codepage, UBool fallback, const int32_t *expectOffsets) { UErrorCode status = U_ZERO_ERROR; UConverter *conv = 0; @@ -450,43 +450,44 @@ static UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const U static void TestConvertFallBackWithBufferSizes(int32_t outsize, int32_t insize ) { - UChar SBCSText[] = + static const UChar SBCSText[] = { 0x0021, 0xFF01, 0x0022, 0xFF02, 0x0023, 0xFF03, 0x003A, 0xFF1A, 0x003B, 0xFF1B, 0x003C, 0xFF1C }; /* 21, ?, 22, ?, 23, ?, 3a, ?, 3b, ?, 3c, ? SBCS*/ - const uint8_t expectedNative[] = + static const uint8_t expectedNative[] = { 0x21, 0x21, 0x22, 0x22, 0x23, 0x23, 0x3a, 0x3a, 0x3b, 0x3b, 0x3c, 0x3c}; - UChar retrievedSBCSText[]= + static const UChar retrievedSBCSText[]= { 0x0021, 0x0021, 0x0022, 0x0022, 0x0023, 0x0023, 0x003A, 0x003A, 0x003B, 0x003B, 0x003C, 0x003C }; - int32_t toNativeOffs [] = + static const int32_t toNativeOffs [] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b}; - int32_t fromNativeoffs [] = + static const int32_t fromNativeoffs [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; - UChar DBCSText[] = + /* 1363 isn't DBCS, but it has the DBCS section */ + static const UChar DBCSText[] = { 0x00a1, 0x00ad, 0x2010, 0x00b7, 0x30fb}; - const uint8_t expectedIBM1362[] = + static const uint8_t expectedIBM1363_DBCS[] = { 0xa2, 0xae, 0xa1 ,0xa9, 0xa1, 0xa9,0xa1 ,0xa4, 0xa1, 0xa4}; - UChar retrievedDBCSText[]= + static const UChar retrievedDBCSText[]= { 0x00a1, 0x2010, 0x2010, 0x30fb, 0x30fb }; - int32_t toIBM1362Offs [] = + static const int32_t toIBM1363Offs_DBCS[] = { 0x00, 0x00, 0x01,0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04}; - int32_t fromIBM1362offs [] = + static const int32_t fromIBM1363offs_DBCS[] = { 0, 2, 4, 6, 8}; - UChar MBCSText[] = + static const UChar MBCSText[] = { 0x0001, 0x263a, 0x2013, 0x2014, 0x263b, 0x0002}; - const uint8_t expectedIBM1370[] = + static const uint8_t expectedIBM1370[] = { 0x01, 0x01, 0xa1, 0x56, 0xa1, 0x56, 0x02, 0x02}; - UChar retrievedMBCSText[]= + static const UChar retrievedMBCSText[]= { 0x0001, 0x0001, 0x2014, 0x2014, 0x0002, 0x0002}; - int32_t toIBM1370Offs [] = + static const int32_t toIBM1370Offs [] = { 0x00, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x05}; - int32_t fromIBM1370offs [] = + static const int32_t fromIBM1370offs [] = { 0, 1, 2, 4, 6, 7}; - UChar MBCSText1363[] = + static const UChar MBCSText1363[] = { 0x0005, 0xffe8, 0x0007, @@ -496,7 +497,7 @@ static void TestConvertFallBackWithBufferSizes(int32_t outsize, int32_t insize ) 0x3016, 0x30fb, 0x9a36}; - const uint8_t expectedIBM1363[] = + static const uint8_t expectedIBM1363[] = { 0x05, 0x05, 0x07, @@ -506,16 +507,16 @@ static void TestConvertFallBackWithBufferSizes(int32_t outsize, int32_t insize ) 0xa1, 0xe0, 0xa1, 0xa4, 0xf5, 0xe2}; - UChar retrievedMBCSText1363[]= + static const UChar retrievedMBCSText1363[]= { 0x0005, 0x0005, 0x0007, 0x0007, 0x001a, 0x30fb, 0x25a1, 0x30fb, 0x9a36}; - int32_t toIBM1363Offs [] = + static const int32_t toIBM1363Offs [] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x08}; - int32_t fromIBM1363offs [] = + static const int32_t fromIBM1363offs [] = { 0, 1, 2, 3, 4, 5, 7, 9, 11}; - const char* nativeCodePage[]={ + static const char* nativeCodePage[]={ /*NLCS Mapping*/ "ibm-367", "ibm-1051", @@ -549,12 +550,12 @@ static void TestConvertFallBackWithBufferSizes(int32_t outsize, int32_t insize ) /*DBCS*/ if(!testConvertFromUnicode(DBCSText, sizeof(DBCSText)/sizeof(DBCSText[0]), - expectedIBM1362, sizeof(expectedIBM1362), "ibm-1362", TRUE, toIBM1362Offs )) - log_err("u-> ibm-1362(DBCS) with FallBack did not match.\n"); + expectedIBM1363_DBCS, sizeof(expectedIBM1363_DBCS), "ibm-1363", TRUE, toIBM1363Offs_DBCS )) + log_err("u-> ibm-1363(DBCS portion) with FallBack did not match.\n"); - if(!testConvertToUnicode(expectedIBM1362, sizeof(expectedIBM1362), - retrievedDBCSText, sizeof(retrievedDBCSText)/sizeof(retrievedDBCSText[0]),"ibm-1362", TRUE, fromIBM1362offs )) - log_err("ibm-1362->u(DBCS) with Fallback did not match.\n"); + if(!testConvertToUnicode(expectedIBM1363_DBCS, sizeof(expectedIBM1363_DBCS), + retrievedDBCSText, sizeof(retrievedDBCSText)/sizeof(retrievedDBCSText[0]),"ibm-1363", TRUE, fromIBM1363offs_DBCS )) + log_err("ibm-1363->u(DBCS portion) with Fallback did not match.\n"); /*MBCS*/ diff --git a/icu4c/source/test/cintltst/ncnvfbts.h b/icu4c/source/test/cintltst/ncnvfbts.h index 369cc76dc15..a47e141ccfc 100644 --- a/icu4c/source/test/cintltst/ncnvfbts.h +++ b/icu4c/source/test/cintltst/ncnvfbts.h @@ -21,9 +21,9 @@ static void TestConverterFallBack(void); static void TestConvertFallBackWithBufferSizes(int32_t outsize, int32_t insize ); static UBool testConvertFromUnicode(const UChar *source, int sourceLen, const uint8_t *expect, int expectLen, - const char *codepage, UBool fallback, int32_t *expectOffsets); + const char *codepage, UBool fallback, const int32_t *expectOffsets); static UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *expect, int expectlen, - const char *codepage, UBool fallback, int32_t *expectOffsets); + const char *codepage, UBool fallback, const int32_t *expectOffsets); static void printSeq(const unsigned char* a, int len); diff --git a/icu4c/source/test/cintltst/ncnvtst.c b/icu4c/source/test/cintltst/ncnvtst.c index 2a85bc4327b..646b8edb33d 100644 --- a/icu4c/source/test/cintltst/ncnvtst.c +++ b/icu4c/source/test/cintltst/ncnvtst.c @@ -147,11 +147,11 @@ static void TestSurrogateBehaviour(){ /*DBCS*/ if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]), - expected, sizeof(expected), "ibm-1362", 0 , TRUE, U_ZERO_ERROR)) - log_err("u-> ibm-1362 [UCNV_DBCS] not match.\n"); + expected, sizeof(expected), "ibm-1363", 0 , TRUE, U_ZERO_ERROR)) + log_err("u-> ibm-1363 [UCNV_DBCS portion] not match.\n"); if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]), - expected, sizeof(expected), "ibm-1362", offsets , TRUE, U_ZERO_ERROR)) - log_err("u-> ibm-1362 [UCNV_DBCS] not match.\n"); + expected, sizeof(expected), "ibm-1363", offsets , TRUE, U_ZERO_ERROR)) + log_err("u-> ibm-1363 [UCNV_DBCS portion] not match.\n"); /*MBCS*/ if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]), expected, sizeof(expected), "ibm-1363", 0 , TRUE, U_ZERO_ERROR)) @@ -367,26 +367,26 @@ static void TestErrorBehaviour(){ /*DBCS*/ if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]), - expected, sizeof(expected), "ibm-1362", 0, TRUE, U_TRUNCATED_CHAR_FOUND)) - log_err("u-> ibm-1362 [UCNV_DBCS] is supposed to fail\n"); + expected, sizeof(expected), "ibm-1363", 0, TRUE, U_TRUNCATED_CHAR_FOUND)) + log_err("u-> ibm-1363 [UCNV_DBCS portion] is supposed to fail\n"); if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]), - expected, sizeof(expected), "ibm-1362", 0, FALSE, U_ZERO_ERROR)) - log_err("u-> ibm-1362 [UCNV_DBCS] is supposed to fail\n"); + expected, sizeof(expected), "ibm-1363", 0, FALSE, U_ZERO_ERROR)) + log_err("u-> ibm-1363 [UCNV_DBCS portion] is supposed to fail\n"); if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]), - expected, sizeof(expected), "ibm-1362", offsets, TRUE, U_TRUNCATED_CHAR_FOUND)) - log_err("u-> ibm-1362 [UCNV_DBCS] is supposed to fail\n"); + expected, sizeof(expected), "ibm-1363", offsets, TRUE, U_TRUNCATED_CHAR_FOUND)) + log_err("u-> ibm-1363 [UCNV_DBCS portion] is supposed to fail\n"); if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]), - expected, sizeof(expected), "ibm-1362", offsets, FALSE, U_ZERO_ERROR)) - log_err("u-> ibm-1362 [UCNV_DBCS] is supposed to fail\n"); + expected, sizeof(expected), "ibm-1363", offsets, FALSE, U_ZERO_ERROR)) + log_err("u-> ibm-1363 [UCNV_DBCS portion] is supposed to fail\n"); if(!convertFromU(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]), - expected2, sizeof(expected2), "ibm-1362", 0, TRUE, U_ZERO_ERROR)) - log_err("u-> ibm-1362 [UCNV_DBCS] did not match \n"); + expected2, sizeof(expected2), "ibm-1363", 0, TRUE, U_ZERO_ERROR)) + log_err("u-> ibm-1363 [UCNV_DBCS portion] did not match \n"); if(!convertFromU(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]), - expected2, sizeof(expected2), "ibm-1362", offsets2, TRUE, U_ZERO_ERROR)) - log_err("u-> ibm-1362 [UCNV_DBCS] did not match \n"); + expected2, sizeof(expected2), "ibm-1363", offsets2, TRUE, U_ZERO_ERROR)) + log_err("u-> ibm-1363 [UCNV_DBCS portion] did not match \n"); /*MBCS*/ if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]), @@ -637,15 +637,15 @@ static void TestToUnicodeErrorBehaviour() const UChar expected2[] = { 0x00a1 }; if(!convertToU(sampleText, sizeof(sampleText), - expected, sizeof(expected)/sizeof(expected[0]), "ibm-1362", 0, TRUE, U_ZERO_ERROR )) - log_err("DBCS (ibm-1362)->Unicode did not match.\n"); + expected, sizeof(expected)/sizeof(expected[0]), "ibm-1363", 0, TRUE, U_ZERO_ERROR )) + log_err("DBCS (ibm-1363)->Unicode did not match.\n"); if(!convertToU(sampleText, sizeof(sampleText), - expected, sizeof(expected)/sizeof(expected[0]), "ibm-1362", 0, FALSE, U_ZERO_ERROR )) - log_err("DBCS (ibm-1362)->Unicode with flush = false did not match.\n"); + expected, sizeof(expected)/sizeof(expected[0]), "ibm-1363", 0, FALSE, U_ZERO_ERROR )) + log_err("DBCS (ibm-1363)->Unicode with flush = false did not match.\n"); if(!convertToU(sampleText2, sizeof(sampleText2), - expected2, sizeof(expected2)/sizeof(expected2[0]), "ibm-1362", 0, TRUE, U_TRUNCATED_CHAR_FOUND )) - log_err("DBCS (ibm-1362)->Unicode with TRUNCATED CHARACTER did not match.\n"); + expected2, sizeof(expected2)/sizeof(expected2[0]), "ibm-1363", 0, TRUE, U_TRUNCATED_CHAR_FOUND )) + log_err("DBCS (ibm-1363)->Unicode with TRUNCATED CHARACTER did not match.\n"); } @@ -1480,16 +1480,16 @@ static void TestResetBehaviour(void){ /*DBCS*/ if(!testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]), - expected, sizeof(expected), "ibm-1362", UCNV_FROM_U_CALLBACK_SUBSTITUTE , NULL, TRUE)) - log_err("u-> ibm-1362 [UCNV_DBCS] not match.\n"); + expected, sizeof(expected), "ibm-1363", UCNV_FROM_U_CALLBACK_SUBSTITUTE , NULL, TRUE)) + log_err("u-> ibm-1363 [UCNV_DBCS portion] not match.\n"); if(!testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]), - expected, sizeof(expected), "ibm-1362", UCNV_FROM_U_CALLBACK_SUBSTITUTE,offsets , TRUE)) - log_err("u-> ibm-1362 [UCNV_DBCS] not match.\n"); + expected, sizeof(expected), "ibm-1363", UCNV_FROM_U_CALLBACK_SUBSTITUTE,offsets , TRUE)) + log_err("u-> ibm-1363 [UCNV_DBCS portion] not match.\n"); if(!testConvertToU(expected1, sizeof(expected1), - sampleText1, sizeof(sampleText1)/sizeof(sampleText1[0]), "ibm-1362",UCNV_TO_U_CALLBACK_SUBSTITUTE , + sampleText1, sizeof(sampleText1)/sizeof(sampleText1[0]), "ibm-1363",UCNV_TO_U_CALLBACK_SUBSTITUTE , offsets1, TRUE)) - log_err("ibm-1362 -> did not match.\n"); + log_err("ibm-1363 -> did not match.\n"); /*MBCS*/ if(!testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]), expected, sizeof(expected), "ibm-1363", UCNV_FROM_U_CALLBACK_SUBSTITUTE , NULL, TRUE)) diff --git a/icu4c/source/tools/gencnval/gencnval.c b/icu4c/source/tools/gencnval/gencnval.c index bf975a54b60..29bf75299ae 100644 --- a/icu4c/source/tools/gencnval/gencnval.c +++ b/icu4c/source/tools/gencnval/gencnval.c @@ -70,7 +70,6 @@ #define ALL_TAG_STR "ALL" #define ALL_TAG_NUM 1 #define EMPTY_TAG_NUM 0 -#define USER_TAG_NUM_START 2 /* UDataInfo cf. udata.h */ static const UDataInfo dataInfo={ @@ -561,7 +560,7 @@ addOfficialTaggedStandards(char *line, int32_t lineLen) { uint16_t tagSize; static const char WHITESPACE[] = " \t"; - if (tagCount > USER_TAG_NUM_START) { + if (tagCount > UCNV_NUM_RESERVED_TAGS) { fprintf(stderr, "error(line %d): official tags already added\n", lineNum); exit(U_BUFFER_OVERFLOW_ERROR); } @@ -756,7 +755,7 @@ static void resolveAliasToConverter(uint16_t alias, uint16_t *tagNum, uint16_t *converterNum) { uint16_t idx, idx2, idx3; - for (idx = USER_TAG_NUM_START; idx < tagCount; idx++) { + for (idx = UCNV_NUM_RESERVED_TAGS; idx < tagCount; idx++) { for (idx2 = 0; idx2 < converterCount; idx2++) { for (idx3 = 0; idx3 < tags[idx].aliasList[idx2].aliasCount; idx3++) { uint16_t aliasNum = tags[idx].aliasList[idx2].aliases[idx3]; @@ -794,7 +793,7 @@ resolveAliases(uint16_t *uniqueAliasArr, uint16_t *uniqueAliasToConverterArr, ui uint32_t uniqueAliasIdx = 0; uint32_t idx; uint16_t currTagNum, oldTagNum; - uint16_t currConvNum; + uint16_t currConvNum, oldConvNum; const char *lastName; resolveAliasToConverter(knownAliases[0], &oldTagNum, &currConvNum); @@ -807,7 +806,8 @@ resolveAliases(uint16_t *uniqueAliasArr, uint16_t *uniqueAliasToConverterArr, ui resolveAliasToConverter(knownAliases[idx], &currTagNum, &currConvNum); if (ucnv_compareNames(lastName, GET_ALIAS_STR(knownAliases[idx])) == 0) { /* duplicate found */ - if (currTagNum > oldTagNum) { + if ((currTagNum < oldTagNum && currTagNum >= UCNV_NUM_RESERVED_TAGS) + || oldTagNum == 0) { oldTagNum = currTagNum; uniqueAliasToConverterArr[uniqueAliasIdx - 1] = currConvNum; uniqueAliasArr[uniqueAliasIdx - 1] = knownAliases[idx] + aliasOffset; @@ -816,7 +816,7 @@ resolveAliases(uint16_t *uniqueAliasArr, uint16_t *uniqueAliasToConverterArr, ui GET_ALIAS_STR(knownAliases[idx]), lastName, GET_ALIAS_STR(converters[currConvNum].converter)); - if (uniqueAliasToConverterArr[uniqueAliasIdx - 1] != currConvNum) { + if (oldConvNum != currConvNum) { printf(" (alias conflict)"); } puts(""); @@ -828,22 +828,24 @@ resolveAliases(uint16_t *uniqueAliasArr, uint16_t *uniqueAliasToConverterArr, ui printf("folding %s into %s -> %s", GET_ALIAS_STR(knownAliases[idx]), lastName, - GET_ALIAS_STR(converters[currConvNum].converter)); - if (uniqueAliasToConverterArr[uniqueAliasIdx - 1] != currConvNum) { + GET_ALIAS_STR(converters[oldConvNum].converter)); + if (oldConvNum != currConvNum) { printf(" (alias conflict)"); } puts(""); } } - if (uniqueAliasToConverterArr[uniqueAliasIdx - 1] != currConvNum) { + if (oldConvNum != currConvNum) { uniqueAliasToConverterArr[uniqueAliasIdx - 1] |= UCNV_AMBIGUOUS_ALIAS_MAP_BIT; } } else { uniqueAliasToConverterArr[uniqueAliasIdx] = currConvNum; + oldConvNum = currConvNum; uniqueAliasArr[uniqueAliasIdx] = knownAliases[idx] + aliasOffset; uniqueAliasIdx++; lastName = GET_ALIAS_STR(knownAliases[idx]); + oldTagNum = currTagNum; /*printf("%s -> %s\n", GET_ALIAS_STR(knownAliases[idx]), GET_ALIAS_STR(converters[currConvNum].converter));*/ } } @@ -935,7 +937,7 @@ writeAliasTable(UNewDataMemory *out) { /* write the table of tags */ /* Think of this as the row headers */ - for(i=USER_TAG_NUM_START; i