Fix another BCP 47 validation issue.
Duplicate U-ext keywords are allowed, but previously it's rejected.
Cherry-pick an upstream patch for that.
See https://github.com/unicode-org/icu/pull/136
TBR=gsathya@chromium.org
Bug: v8:8136
Test: v8 - test262/intl402/Locale/constructor-unicode-ext-valid
Change-Id: Iaec82e28e728afb09f5b1d6b63b1d72bedf02e47
Reviewed-on: https://chromium-review.googlesource.com/1238056
Reviewed-by: Jungshik Shin <jshin@chromium.org>
diff --git a/README.chromium b/README.chromium
index b8394e5..fdc4ed2 100644
--- a/README.chromium
+++ b/README.chromium
@@ -282,3 +282,11 @@
https://unicode-org.atlassian.net/browse/ICU-20098
- fix: https://github.com/unicode-org/icu/pull/102
+14. Another cherry-pick of upstream CL for duplicate U-extension
+ handling.
+
+ - patches/langtag_uext.patch
+ - upstream bug:
+ https://unicode-org.atlassian.net/browse/ICU-20140
+ - fix: https://github.com/unicode-org/icu/pull/136
+
diff --git a/patches/langtag_uext.patch b/patches/langtag_uext.patch
new file mode 100644
index 0000000..0502b99
--- /dev/null
+++ b/patches/langtag_uext.patch
@@ -0,0 +1,16 @@
+diff --git a/source/common/uloc_tag.cpp b/source/common/uloc_tag.cpp
+index 32b3d32b..e9a15086 100644
+--- a/source/common/uloc_tag.cpp
++++ b/source/common/uloc_tag.cpp
+@@ -1573,9 +1573,9 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
+ kwd->value = pType;
+
+ if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) {
+- *status = U_ILLEGAL_ARGUMENT_ERROR;
++ // duplicate keyword is allowed, Only the first
++ // is honored.
+ uprv_free(kwd);
+- goto cleanup;
+ }
+ }
+
diff --git a/source/common/uloc_tag.cpp b/source/common/uloc_tag.cpp
index 32b3d32..e9a1508 100644
--- a/source/common/uloc_tag.cpp
+++ b/source/common/uloc_tag.cpp
@@ -1573,9 +1573,9 @@
kwd->value = pType;
if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
+ // duplicate keyword is allowed, Only the first
+ // is honored.
uprv_free(kwd);
- goto cleanup;
}
}