Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CurrentCultureIgnoreCase string compare return false with Culture "en-US-POSIX" #27574

Closed
wli3 opened this issue Oct 8, 2018 · 7 comments
Closed
Labels
area-System.Globalization question Answer questions and provide assistance, not an issue with source code or documentation.
Milestone

Comments

@wli3
Copy link

wli3 commented Oct 8, 2018

Please close if this is by design of "en-US-POSIX". I want to make sure this is intentional. It is odd that a culture with prefix "en-US" will return false when comparing "nukeeper" and "NuKeeper"

public static void Main(string[] args)
{
    CultureInfo.CurrentCulture = new CultureInfo("en-US-POSIX");
    Console.WriteLine("CurrentCulture is {0}.", CultureInfo.CurrentCulture.Name);
    Console.WriteLine(string.Compare("nukeeper", "NuKeeper", StringComparison.CurrentCultureIgnoreCase) == 0);
}
@stephentoub
Copy link
Member

stephentoub commented Oct 8, 2018

cc: @tarekgh

(Tarek, is there a FAQ somewhere about POSIX/C culture handling that we can point people to? The question seems to come up a lot. If there's not already a discussion in the docs, maybe there could be?)

@tarekgh
Copy link
Member

tarekgh commented Oct 8, 2018

@wli3 please look at the comment on the issue https://github.com/dotnet/corefx/issues/32250#issuecomment-420749205

@stephentoub I'll log issue to get this in the official documentation instead.

@tarekgh tarekgh closed this as completed Oct 8, 2018
@tarekgh
Copy link
Member

tarekgh commented Oct 8, 2018

logged the issue dotnet/docs#8179

@nguerrera
Copy link
Contributor

nguerrera commented Oct 8, 2018

In https://github.com/dotnet/cli/issues/10101, this seems to be happening by default on Unbuntu 18.04 on WSL.

Should we be following up with WSL folks to make sure this isn't the default there? The docs issue says "We need to discourage users from using C or Posix cultures and always replace such usage with some other culture like en-US". In this case, I don't think the user has done anything deliberate, they're just using .NET Core on WSL.

@tarekgh
Copy link
Member

tarekgh commented Oct 8, 2018

@nguerrera this is a good idea. if you have a contact from WSL we can contact them.

@nguerrera
Copy link
Contributor

cc @bitcrazed

@nguerrera
Copy link
Contributor

What is it about WSL that causes it to have this culture by default? An environment variable?

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Globalization question Answer questions and provide assistance, not an issue with source code or documentation.
Projects
None yet
Development

No branches or pull requests

5 participants