Repro code:
Console.WriteLine(CultureInfo.InvariantCulture.CompareInfo.IndexOf(string.Empty, "\u200c"));
This should print 0 on all platforms unless we're running under the invariant globalization mode, in which case it should return -1. The reason for this is an incorrect early-exit in CompareInfo.IndexOf, as shown below.
|
if (source.Length == 0) |
|
{ |
|
if (value.Length == 0) |
|
{ |
|
return 0; |
|
} |
|
return -1; |
|
} |
This early exit does not account for the fact that empty strings and non-empty strings may compare as equal under certain collations if the non-empty strings consist only of zero-weight code points.