-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
The result of full-width string comparison with InvariantCultureIgnoreCase has changed in .NET 5 #44789
Comments
Tagging subscribers to this area: @tarekgh, @safern, @krwq Issue Details
|
@Nukepayload2 thanks for reporting the issue. I think you analysis is correct that this happen because switching using ICU but the issue is not ICU itself but how we internally handle this full-width range. we'll work on fixing this issue. |
@Nukepayload2 just to mention the workaround for this issue is do something like: string.Compare("AE", "ae", CultureInfo.InvariantCulture, CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase) == 0 This should gives you the desired behavior and you don't have to switch back to NLS. |
@tarekgh Console.WriteLine(String.Compare("まりお", "マリオ", StringComparison.InvariantCultureIgnoreCase)) .NET Framework output: 1 |
@Nukepayload2 thanks again for the feedback.
Could you please elaborate more about your scenario? I mean why comparing |
Because our Japanese end users expect the same order as Excel when sorting Japanese strings. |
|
@Nukepayload2 do you expect this order with all cultures? or with Japanese cultures only? @ewfian thanks for the references. The second one is from Unicode which is what ICU implementing and that is the behavior I guess the complaint is about. no? could you elaborate more about what you are trying to point at from these references? |
@tarekgh The new behavior base on ICU is what I expected. Just provide some references about Japanese sort order. |
Closing this one per the PR #45079 |
Description
The result of
String.Equals("AE", "ae", StringComparison.InvariantCultureIgnoreCase)
has changed toFalse
in .NET 5 .Steps:
True
.Expected behavior
The output is
True
Actual behavior
The output is
False
Configuration
.NET SDK (reflecting any global.json):
Version: 5.0.100
Commit: 5044b93829
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100\
Host (useful for support):
Version: 5.0.0
Commit: cf258a1
Regression?
Yes. This problem doesn't exist in .NET Framework 4.8 and .NET Core 3.1 .
Other information
Probably caused by switching to ICU. But this documentation didn't mention string comparison behavior changes for full-width strings.
We switched back to NLS because of this problem.
The text was updated successfully, but these errors were encountered: