From: Fredrik Roubert Date: Fri, 15 Feb 2019 19:42:18 +0000 (+0100) Subject: ICU-20431 Both und_XX and _XX should fall back to the default locale X-Git-Tag: release-64-rc~60 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=168c97f32ab669a5787898d2b01399a15edf6176;p=icu 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 87c813c1777..050746da697 100644 --- a/icu4c/source/common/uresbund.cpp +++ b/icu4c/source/common/uresbund.cpp @@ -489,6 +489,9 @@ findFirstExisting(const char* path, char* name, /*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 90c85e7bcad..74c444fd304 100644 --- a/icu4c/source/test/intltest/dtptngts.cpp +++ b/icu4c/source/test/intltest/dtptngts.cpp @@ -1120,7 +1120,8 @@ void IntlTestDateTimePatternGeneratorAPI::testC() { 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;