ICU-2800 Fix the canonical name

X-SVN-Rev: 11533
This commit is contained in:
George Rhoten 2003-04-12 00:14:28 +00:00
parent b8b50699f2
commit f69ff31d30
2 changed files with 22 additions and 5 deletions

View File

@ -607,8 +607,8 @@ _ISO2022Open(UConverter *cnv, const char *name, const char *locale,uint32_t opti
myConverterData->version =options & UCNV_OPTIONS_VERSION_MASK;
uprv_strcpy(myConverterData->name,"ISO_2022,locale=ja,version=");
len=strlen(myConverterData->name);
myConverterData->name[len-1]=(char)(myConverterData->version+(int)'0');
myConverterData->name[len]='\0';
myConverterData->name[len]=(char)(myConverterData->version+(int)'0');
myConverterData->name[len+1]='\0';
}
else if(myLocale[0]=='k' && (myLocale[1]=='o'|| myLocale[1]=='r') &&
(myLocale[2]=='_' || myLocale[2]=='\0')){
@ -654,9 +654,9 @@ _ISO2022Open(UConverter *cnv, const char *name, const char *locale,uint32_t opti
if ((options & UCNV_OPTIONS_VERSION_MASK)==1){
myConverterData->version = 1;
uprv_strcpy(myConverterData->name,"ISO_2022,locale=cn,version=1");
uprv_strcpy(myConverterData->name,"ISO_2022,locale=zh,version=1");
}else{
uprv_strcpy(myConverterData->name,"ISO_2022,locale=cn,version=0");
uprv_strcpy(myConverterData->name,"ISO_2022,locale=zh,version=0");
myConverterData->version = 0;
}
}

View File

@ -1108,14 +1108,31 @@ static void TestAlias() {
const char *alias0;
uint16_t na = ucnv_countAliases(name, &status);
uint16_t j;
UConverter *cnv;
if (na == 0) {
log_data_err("FAIL: Converter \"%s\" (i=%d)"
log_err("FAIL: Converter \"%s\" (i=%d)"
" has no aliases; expect at least one\n",
name, i);
continue;
}
cnv = ucnv_open(name, &status);
if (U_FAILURE(status)) {
log_data_err("FAIL: Converter \"%s\" (i=%d)"
" can't be opened.\n",
name, i);
}
else {
if (strcmp(ucnv_getName(cnv, &status), name) != 0
&& (strstr(name, "PlatformEndian") == 0 && strstr(name, "OppositeEndian") == 0)) {
log_err("FAIL: Converter \"%s\" returned \"%s\" for getName. "
"The should be the same\n",
name, ucnv_getName(cnv, &status));
}
}
ucnv_close(cnv);
status = U_ZERO_ERROR;
alias0 = ucnv_getAlias(name, 0, &status);
for (j=1; j<na; ++j) {
const char *alias;