ICU-20431 Both und_XX and _XX should fall back to the default locale
diff --git a/icu4c/source/common/uresbund.cpp b/icu4c/source/common/uresbund.cpp
index 87c813c..050746d 100644
--- a/icu4c/source/common/uresbund.cpp
+++ b/icu4c/source/common/uresbund.cpp
@@ -489,6 +489,9 @@
/*Fallback data stuff*/
*hasChopped = chopLocale(name);
+ if (*hasChopped && *name == '\0') {
+ uprv_strcpy(name, "und");
+ }
}
return r;
}
diff --git a/icu4c/source/test/intltest/dtptngts.cpp b/icu4c/source/test/intltest/dtptngts.cpp
index 90c85e7..74c444f 100644
--- a/icu4c/source/test/intltest/dtptngts.cpp
+++ b/icu4c/source/test/intltest/dtptngts.cpp
@@ -1120,7 +1120,8 @@
UErrorCode status = U_ZERO_ERROR;
int32_t numTests = UPRV_LENGTHOF(tests);
for (int32_t i = 0; i < numTests; ++i) {
- DateTimePatternGenerator *gen = DateTimePatternGenerator::createInstance(Locale(tests[i][0]), status);
+ DateTimePatternGenerator *gen = DateTimePatternGenerator::createInstance(
+ Locale::forLanguageTag(tests[i][0], status), status);
if (gen == NULL) {
dataerrln("FAIL: DateTimePatternGenerator::createInstance failed for %s", tests[i][0]);
return;