mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-16 10:17:23 +00:00
ICU-555 Fallback (default) conversion
X-SVN-Rev: 6798
This commit is contained in:
parent
d1fc5965f4
commit
127853b0fd
2 changed files with 27 additions and 4 deletions
|
@ -1443,13 +1443,13 @@ const char* uprv_getDefaultCodepage()
|
|||
}
|
||||
else
|
||||
{
|
||||
/* if the table lookup failed, return latin1. */
|
||||
uprv_strcpy(codesetName, "LATIN_1");
|
||||
/* if the table lookup failed, return US ASCII (ISO 646). */
|
||||
uprv_strcpy(codesetName, "US-ASCII");
|
||||
}
|
||||
}
|
||||
return codesetName;
|
||||
#else
|
||||
return "LATIN_1";
|
||||
return "US-ASCII";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -491,9 +491,32 @@ ucnv_io_getDefaultConverterName() {
|
|||
if(U_FAILURE(errorCode) || name==NULL) {
|
||||
name=codepage;
|
||||
}
|
||||
defaultConverterName=name;
|
||||
}
|
||||
|
||||
/* if the name is there, test it out */
|
||||
|
||||
if(name != NULL) {
|
||||
UErrorCode errorCode = U_ZERO_ERROR;
|
||||
UConverter *cnv;
|
||||
cnv = ucnv_open(name, &errorCode);
|
||||
if(U_FAILURE(errorCode) || (cnv == NULL)) {
|
||||
|
||||
/* Panic time, let's use a fallback. */
|
||||
#if (U_CHARSET_FAMILY == U_ASCII_FAMILY)
|
||||
name = "US-ASCII";
|
||||
#else
|
||||
name = "ibm-37"; /* there is no 'algorithmic' converter for ebcdic. */
|
||||
#endif
|
||||
}
|
||||
ucnv_close(cnv);
|
||||
}
|
||||
|
||||
if(name != NULL) {
|
||||
/* Did find a name. And it works.*/
|
||||
defaultConverterName=name;
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue