-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Description
Now, I'm aware of https://docs.microsoft.com/en-us/dotnet/standard/base-types/string-comparison-net-5-plus
Please see the screenshot ("Immediate window" in VS debugger) and comments below.
Reproduction Steps
Set locale to norwegian bokmål (NOB). "aa".StartsWith("a") returns false, which might be explainable with the breaking behavior I linked to above. However, "aa".StartsWith("å") returns false as well
Expected behavior
At least "aa".StartsWith("å") should then return true as "å" is "linguistically the same" as "aa". Otherwise, you tell me. The observed behavior totally breaks the expectation of a "string being a sequence of characters". It almost makes me want to replace all string types with List<char>.
Actual behavior
Please see the screenshots. Totally crazy, I spent two hours diagnosing the issue.
Regression?
No response
Known Workarounds
Explicitly use StringComparison.Ordinal. Alternately, set the program's culture to invariant, like this System.Globalization.CultureInfo.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
Configuration
Windows 11, .net 6.0.5, x64. Mixed locale: english as display language, several keyboard layouts installed (ENG and NOB).
Other information
No response
