You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
String.StartsWith/EndsWith/IndexOf/LastIndexOf ignoring null characters on Unix #4673
I believe this is by design in Linux as Linux ignore the null characters. i.e. null characters has no weights for the string comparison. if someone want to to have accurate result should use ordinal comparisons and not linguistic comparison. I understand this is different than Windows but we already have some differences between Windows and Linux in this space.
@tarekgh Can this be closed? I confirmed that the null character is a weightless character in ICU.
auto status = UErrorCode{};
UCollator* collator = ucol_open("", &status);
uint8_t sortKey[64];
auto result = ucol_getSortKey(
collator,
(UChar*)L"ab\0cd",
5,
sortKey,
sizeof(sortKey));
result = ucol_getSortKey(
collator,
(UChar*)L"abcd",
4,
sortKey,
sizeof(sortKey));
The two calls above will return the same value for result and will both populate sortKey with the same data. This indicates that per ICU the strings "ab\0cd" and "abcd" are equal.
Activity
Baseline tests against dotnet/coreclr#2051
Merge pull request #8492 from ellismg/index-of-null
Baseline failures against dotnet/coreclr#2051
AlexGhiondea commentedon Feb 2, 2017
@tarekgh would you mind taking a look at this?
tarekgh commentedon Feb 2, 2017
I believe this is by design in Linux as Linux ignore the null characters. i.e. null characters has no weights for the string comparison. if someone want to to have accurate result should use ordinal comparisons and not linguistic comparison. I understand this is different than Windows but we already have some differences between Windows and Linux in this space.
AlexGhiondea commentedon Feb 2, 2017
Closing per @tarekgh's comments
KristinXie1 commentedon Feb 24, 2017
Disabled test, reopen it.
KristinXie1 commentedon Feb 27, 2017
https://github.com/dotnet/corefx/blob/master/src/System.Runtime/tests/System/StringTests.cs#L835
tarekgh commentedon Feb 27, 2017
@AlexGhiondea I have marked this as a test issue and moved it to the future. please change it back if you think otherwise.
GrabYourPitchforks commentedon Jan 29, 2020
@tarekgh Can this be closed? I confirmed that the null character is a weightless character in ICU.
The two calls above will return the same value for
resultand will both populatesortKeywith the same data. This indicates that per ICU the strings"ab\0cd"and"abcd"are equal.tarekgh commentedon Jan 29, 2020
@GrabYourPitchforks I am closing it. I assume there is no test failing because of that today.
safern commentedon Feb 15, 2020
There are still some tests disabled against this issue (with coreclr URL).
runtime/src/libraries/Common/tests/Tests/System/StringTests.cs
Line 1682 in 50bd5ba