You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Powershell Hashtable Keys are case-sensitive on Ubuntu 18.04 #7761
Travis Plunk (@TravisEz13) made the point that this behaviour may be by design: the if the C.UTF-8 locale is supposed to be something along the lines of "culture invariant", then case-sensitivity may not mean anything and it just performs a strict codepoint-to-codepoint comparison.
However, from the Debian manpage linked above, it sounds like the standard C locale should obey the casing rules of en_US, meaning C.UTF-8 should obey the casing rules of en_US.UTF-8. So this is a bug, probably in .NET Core.
Activity
BrucePay commentedon Sep 12, 2018
How odd. The code that constructs a hashtable is hard-coded to be case-insensitive:
What happens when you manually create the hashtable?
rjmholt commentedon Sep 12, 2018
James Truher (@JamesWTruher) found that this is due to Ubuntu 18.04's default
LANG=C.UTF-8(compare to 16.04'sLANG=en-us.UTF-8for our installs).Travis Plunk (@TravisEz13) made the point that this behaviour may be by design: the if the
C.UTF-8locale is supposed to be something along the lines of "culture invariant", then case-sensitivity may not mean anything and it just performs a strict codepoint-to-codepoint comparison.However, from the Debian manpage linked above, it sounds like the standard C locale should obey the casing rules of en_US, meaning C.UTF-8 should obey the casing rules of en_US.UTF-8. So this is a bug, probably in .NET Core.
Also worth mentioning Travis Plunk (@TravisEz13)'s note of .NET's culture invariant mode: dotnet/announcements#20
rjmholt commentedon Sep 12, 2018
I've managed a simple repro that doesn't depend on PowerShell and have opened an issue in corefx
rjmholt commentedon Sep 12, 2018
CoreFX have designated the behaviour with that locale as by design as Travis Plunk (@TravisEz13) suggested, see https://github.com/dotnet/corefx/issues/32250#issuecomment-420749205.
The options I see for our handling of it are:
CultureInvariantIgnoreCaseorOrdinalIgnoreCaseas I think Bruce Payette (@BrucePay) suggestedrjmholt commentedon Sep 13, 2018
.NET team's suggested workaround: https://github.com/dotnet/corefx/issues/28611#issuecomment-386120096
Official POSIX locale documentation from the Open Group: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html#tag_07_02
rjmholt commentedon Nov 6, 2018
Apparently there are issues with
CultureInfo.InvariantCulture: dotnet/roslyn#29938 (comment)bergmeister commentedon Dec 29, 2018
I suggest to use OrdinalIgnoreCase for the hashtable comparison please. It would be great if a fix for this gets shipped in the next patch of 6.1.
SteveL-MSFT commentedon Dec 31, 2018
Christoph Bergmeister (@bergmeister) Setting LANG before starting pwsh is a viable workaround. I don't think this will be in next 6.1 patch.
ffeldhaus commentedon Dec 31, 2018
I just checked that the issue also affects Mac OS if
LANGis set toC.utf8.