]> granicus.if.org Git - icu/commitdiff
ICU-8260 bug fixes
authorMarkus Scherer <markus.icu@gmail.com>
Wed, 28 May 2014 23:03:52 +0000 (23:03 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Wed, 28 May 2014 23:03:52 +0000 (23:03 +0000)
X-SVN-Rev: 35766

icu4c/source/i18n/coll.cpp
icu4c/source/i18n/ucol_res.cpp
icu4c/source/test/testdata/collationtest.txt

index 49a4860e08d7aff292e326f243ae52c45b69a58f..42a1638e32b85fc272c0d6d2c5851d0f4eb11d06 100644 (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 (;;) {
index 13295fb68a75a515158964c179d7197fd38df237..3b37db015fb7128bcca5cfc4b20a8b8f3b2e9cae 100644 (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; }
index 777ed15234ea1f9fde989b35fc562c942d5c2495..74c46cbc419d1333ef273339e5220a703cfd0256 100644 (file)
 <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