From: Yoshito Umaoka Date: Tue, 2 Sep 2014 23:41:52 +0000 (+0000) Subject: ICU-8951 Minor updates including additional test cases. X-Git-Tag: milestone-59-0-1~1652 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e14f0bb18c7045aef921821992d91620cdaac03;p=icu ICU-8951 Minor updates including additional test cases. X-SVN-Rev: 36316 --- diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java b/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java index e28726755ec..5f23061b697 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java @@ -3292,12 +3292,12 @@ public final class ULocale implements Serializable, Comparable { * @provisional This API might change or be removed in a future release. */ public static String toUnicodeLocaleKey(String keyword) { - String uniLocKey = KeyTypeData.toBcpKey(keyword); - if (uniLocKey == null && UnicodeLocaleExtension.isKey(keyword)) { + String bcpKey = KeyTypeData.toBcpKey(keyword); + if (bcpKey == null && UnicodeLocaleExtension.isKey(keyword)) { // unknown keyword, but syntax is fine.. - uniLocKey = AsciiUtil.toLowerString(keyword); + bcpKey = AsciiUtil.toLowerString(keyword); } - return uniLocKey; + return bcpKey; } /** diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ULocaleTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ULocaleTest.java index ecc2f9a9b72..a7eb6150332 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ULocaleTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ULocaleTest.java @@ -4508,6 +4508,10 @@ public class ULocaleTest extends TestFmwk { {"ca", "gregory-japanese-islamic", "gregory-japanese-islamic"}, // unknown type, well-formed type {"zz", "gregorian", null}, // unknown key, ill-formed type {"co", "foo-", null}, // unknown type, ill-formed type + {"variableTop", "00A0", "00a0"}, // valid codepoints type + {"variableTop", "wxyz", "wxyz"}, // invalid codepoints type - return as is for now + {"kr", "space-punct", "space-punct"}, // valid reordercode type + {"kr", "digit-spacepunct", null}, // invalid reordercode type }; for (String[] d : DATA) { @@ -4542,6 +4546,10 @@ public class ULocaleTest extends TestFmwk { {"zz", "gregorian", "gregorian"}, // unknown key, bcp ill-formed type {"ca", "gregorian-calendar", "gregorian-calendar"}, // known key, bcp ill-formed type {"co", "e=mc2", null}, // known key, ill-formed bcp/legacy type + {"variableTop", "00A0", "00a0"}, // valid codepoints type + {"variableTop", "wxyz", "wxyz"}, // invalid codepoints type - return as is for now + {"kr", "space-punct", "space-punct"}, // valid reordercode type + {"kr", "digit-spacepunct", "digit-spacepunct"}, // invalid reordercode type, bad ok for legacy syntax }; for (String[] d : DATA) {