Reputation: 2878
I am having a problem sorting Swedish strings.
I am having problems with the following characters: v, w, å, ä, ö.
new[] { "ö", "ä", "å", "wa", "va", "wb", "vb", "a" }
.OrderBy(x => x, new CultureInfo("sv-SE").CompareInfo.GetStringComparer(CompareOptions.None))
Expected: a, va, vb, wa, wb, å, ä, ö
Actual: a, va, wa, vb, wb, å, ä, ö
Is the there any option to make it sort the strings as expected?
Upvotes: 6
Views: 957
Reputation: 2878
As a work-around I have switched to the culture se-SE (Sami) just for sorting alphabetic strings correctly while I wait for the .NET sorting rules to be updated.
Update:
Here is the github issue: https://github.com/dotnet/corefx/issues/37753
Update2:
The issue is not with .NET, it is the sorting rules defined in the underlying operating system. This error is only present on Windows.
Upvotes: 3