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; }
<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