summaryrefslogtreecommitdiff
path: root/src/corefx/System.Globalization.Native/localeStringData.cpp
diff options
context:
space:
mode:
authorMatt Ellis <matell@microsoft.com>2016-04-19 14:58:12 -0700
committerMatt Ellis <matell@microsoft.com>2016-04-25 15:26:55 -0700
commitdb3ad091c544ae67f8f32fe36245fcb1210f6111 (patch)
treee5d1f43ebab45aed453d7d8a98128886ff3ea7e7 /src/corefx/System.Globalization.Native/localeStringData.cpp
parentfa9d085cfffe748f0bb9c977d0ddf00b0d654168 (diff)
downloadcoreclr-db3ad091c544ae67f8f32fe36245fcb1210f6111.tar.gz
coreclr-db3ad091c544ae67f8f32fe36245fcb1210f6111.tar.bz2
coreclr-db3ad091c544ae67f8f32fe36245fcb1210f6111.zip
Change how we detect the default locale
Previously, we would just ask ICU what it thought the default locale was, since that seemed like a reasonable thing to do. However, in cases where LANG, LC_MESSAGES and LC_ALL where unset and setlocale(3) returned "C", ICU would use "en-US-POSIX" as a default locale. The above case is actually what happens by default when you are running in docker and en-US-POSIX has very odd collation rules (ASCII characters which differ only by case are still treated as seperate letters) which trip folks up. So in this case, we'll use Invariant. If setlocale(3) returns a non C/POSIX locale or any of LANG, LC_MESSAGES, or LC_ALL are set to non empty values, we'll continue to let ICU figure out what to do.
Diffstat (limited to 'src/corefx/System.Globalization.Native/localeStringData.cpp')
-rw-r--r--src/corefx/System.Globalization.Native/localeStringData.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corefx/System.Globalization.Native/localeStringData.cpp b/src/corefx/System.Globalization.Native/localeStringData.cpp
index 6adb38f9ac..927da67095 100644
--- a/src/corefx/System.Globalization.Native/localeStringData.cpp
+++ b/src/corefx/System.Globalization.Native/localeStringData.cpp
@@ -179,7 +179,7 @@ extern "C" int32_t GlobalizationNative_GetLocaleInfoString(
switch (localeStringData)
{
case LocalizedDisplayName:
- uloc_getDisplayName(locale, uloc_getDefault(), value, valueLength, &status);
+ uloc_getDisplayName(locale, DetectDefaultLocaleName(), value, valueLength, &status);
break;
case EnglishDisplayName:
uloc_getDisplayName(locale, ULOC_ENGLISH, value, valueLength, &status);
@@ -188,7 +188,7 @@ extern "C" int32_t GlobalizationNative_GetLocaleInfoString(
uloc_getDisplayName(locale, locale, value, valueLength, &status);
break;
case LocalizedLanguageName:
- uloc_getDisplayLanguage(locale, uloc_getDefault(), value, valueLength, &status);
+ uloc_getDisplayLanguage(locale, DetectDefaultLocaleName(), value, valueLength, &status);
break;
case EnglishLanguageName:
uloc_getDisplayLanguage(locale, ULOC_ENGLISH, value, valueLength, &status);