-
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
String comparison regression bug #96205
Comments
Tagging subscribers to this area: @DavoudEshtehari, @David-Engel, @JRahnama Issue DetailsDescriptionThe SqlString class comparison logic returns incorrect result for some string. Reproduction Stepsusing System;
using System.Linq;
using System.Data.SqlTypes;
public class Program
{
public static void Main()
{
var sqlCompareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreNonSpace | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth;
var res = new SqlString("ʻ", 1033, sqlCompareOptions) == new SqlString("", 1033, sqlCompareOptions);
Console.WriteLine(res);
}
} Expected behaviorConsole prints True Actual behaviorConsole prints False Regression?It's a regression. Known WorkaroundsNone that I'm aware of. Configuration.NET 8 Windows x64 Other informationThis seems to be a regression. It works in .NET framework but not .NET core
|
Tagging subscribers to this area: @dotnet/area-system-globalization Issue DetailsDescriptionThe String comparison logic returns incorrect result for some string. Reproduction Stepsusing System;
using System.Globalization;
public class Program
{
public static void Main()
{
Console.WriteLine(new CultureInfo("en-US").CompareInfo.Compare("ʻ", "", CompareOptions.IgnoreNonSpace));
}
} Expected behaviorConsole prints 0 Actual behaviorConsole prints 1 Regression?It's a regression. Known WorkaroundsNone that I'm aware of. Configuration.NET 8 Windows x64 Other informationThis seems to be a regression. It works in .NET framework but not .NET core
|
There is wide globalization change between .NET Framework and .NET Core. .NET Framework uses Windows NLS while .NET Core uses ICU by default. See https://learn.microsoft.com/dotnet/core/extensions/globalization-icu . With that said, this may be a bug of CompareOptions.IgnoreNonSpace handling in .NET Core. |
@huoyaoyuan the doc says that ICU is used from .NET 5 onwards but I can reproduce the issue even with .NET Core 3.1 so it might not be related to the ICU change |
Actually sorry, I cannot reproduce with .NET Core 3.1 |
Closing this as per replies. Apps want to get the old behavior can use use nls instead of icu. We don't recommend it though as in the future this will be legacy obsolete behavior. |
Description
The String comparison logic returns incorrect result for some string.
Reproduction Steps
Expected behavior
Console prints 0
Actual behavior
Console prints 1
Regression?
It's a regression.
It works fine in .NET framework 4.7.2 so it appears the bug is limited to .NET core
Known Workarounds
None that I'm aware of.
Configuration
.NET 8 Windows x64
Other information
This seems to be a regression. It works in .NET framework but not .NET core
The text was updated successfully, but these errors were encountered: