-
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
.Net 5: For Thai, IndexOf(string) returns wrong index for some strings #59120
Comments
Tagging subscribers to this area: @tarekgh, @safern Issue DetailsThis issue has been moved from a ticket on Developer Community. [regression] [worked-in:.net core 3.1] Example: Notes
Original CommentsFeedback Bot on 9/7/2021, 01:21 AM:We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps. Original Solutions(no solutions)
|
I added this to the big list at #43956. |
It regressed in 5.0, would be good to also test in 6.0. @GrabYourPitchforks @tarekgh is this something we'd need to look at in 6.0? |
Doing
That is expected result as I mentioned before.
I am not getting this result using .NET 5.0 nor .NET 6.0. Are you sure
That is because in net core 3.1 we were using Windows
This normal as different languages behave differently. Note, Thai language is special case when it comes to word breaking as this language doesn't use spaces between words. So, you can expect some such other behaviors you are seeing too.
That is expected too. When you search using character, the search will be performed as ordinal search operation and not as linguistic search. Which means "0".IndexOf(".", StringComparison.Ordinal); @GrabYourPitchforks please review my reply here just in case you need to update anything again in #43956. |
@tarekgh I don't have anything to add to your reply. It is very well stated. :) Given that OP referred to this behavior as a "problem" and called out the clear contrast with the ordinal routine |
This issue has been automatically marked |
This issue has been moved from a ticket on Developer Community.
[regression] [worked-in:.net core 3.1]
Using .NET 5 IndexOf(string) returns wrong index.
This is reproducible only for some input strings, when the culture is set to Thai.
Example:
CultureInfo.CurrentCulture = new CultureInfo("th");
var idxSeparator = "27".IndexOf("."); // returns 0 instead of -1
idxSeparator = "0".IndexOf("."); // returns -1 as expected
idxSeparator = "3".IndexOf("."); // returns -1 as expected
idxSeparator = "3345".IndexOf("."); // returns 0 instead of -1
Notes
Original Comments
Feedback Bot on 9/7/2021, 01:21 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: