ICU-8260 bug fixes

X-SVN-Rev: 35766
This commit is contained in:
Markus Scherer 2014-05-28 23:03:52 +00:00
parent 650ab573ea
commit b3cb5dcc86
3 changed files with 19 additions and 3 deletions

View file

@ -369,7 +369,7 @@ void setAttributesFromKeywords(const Locale &loc, Collator &coll, UErrorCode &er
return;
}
if (length != 0) {
int32_t codes[ + UCOL_REORDER_CODE_LIMIT - UCOL_REORDER_CODE_FIRST];
int32_t codes[USCRIPT_CODE_LIMIT + UCOL_REORDER_CODE_LIMIT - UCOL_REORDER_CODE_FIRST];
int32_t codesLength = 0;
char *scriptName = value;
for (;;) {

View file

@ -104,12 +104,21 @@ UnicodeString *
CollationLoader::loadRules(const char *localeID, const char *collationType, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) { return NULL; }
U_ASSERT(collationType != NULL && *collationType != 0);
// Copy the type for lowercasing.
char type[16];
int32_t typeLength = uprv_strlen(collationType);
if(typeLength >= LENGTHOF(type)) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
uprv_memcpy(type, collationType, typeLength + 1);
T_CString_toLowerCase(type);
LocalUResourceBundlePointer bundle(ures_open(U_ICUDATA_COLL, localeID, &errorCode));
LocalUResourceBundlePointer collations(
ures_getByKey(bundle.getAlias(), "collations", NULL, &errorCode));
LocalUResourceBundlePointer data(
ures_getByKeyWithFallback(collations.getAlias(), collationType, NULL, &errorCode));
ures_getByKeyWithFallback(collations.getAlias(), type, NULL, &errorCode));
int32_t length;
const UChar *s = ures_getStringByKey(data.getAlias(), "Sequence", &length, &errorCode);
if(U_FAILURE(errorCode)) { return NULL; }

View file

@ -2389,13 +2389,20 @@
<2 alà # backwards secondary level
** test: locale -u- with script reordering, ICU ticket 8260
@ locale el-u-kr-kana-SYMBOL-Grek
@ locale el-u-kr-kana-SYMBOL-Grek-hani-cyrl-latn-digit-armn-deva-ethi-thai
* compare
<1 \u0020
<1 あ
<1 ☂
<1 Ω
<1 丂
<1 ж
<1 L
<1 4
<1 Ձ
<1 अ
<1 ሄ
<1 ฉ
** test: locale @collation=type should be case-insensitive
@ locale de@coLLation=PhoneBook