Skip to content
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

Fix String#index and #rindex for Char::REPLACEMENT #14937

Merged

Conversation

HertzDevil
Copy link
Contributor

If the string consists only of ASCII characters and invalid UTF-8 byte sequences, all the latter should correspond to Char::REPLACEMENT, and so #index and #rindex should detect them, but this was broken since #14461.

@HertzDevil HertzDevil added kind:bug topic:stdlib:text kind:regression Something that used to correctly work but no longer works labels Aug 23, 2024
Copy link
Member

@straight-shoota straight-shoota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While at it, we could also add specs for searching for Char::REPLACEMENT in a string that is not single_byte_optimizable.

@straight-shoota straight-shoota added this to the 1.14.0 milestone Aug 23, 2024
@straight-shoota straight-shoota merged commit 0ad3e91 into crystal-lang:master Aug 25, 2024
65 checks passed
@HertzDevil HertzDevil deleted the bug/string-index-replacement branch August 27, 2024 06:58
@straight-shoota straight-shoota modified the milestones: 1.14.0, 1.13.3 Sep 10, 2024
straight-shoota pushed a commit that referenced this pull request Sep 17, 2024
If the string consists only of ASCII characters and invalid UTF-8 byte sequences, all the latter should correspond to `Char::REPLACEMENT`, and so `#index` and `#rindex` should detect them, but this was broken since #14461.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug kind:regression Something that used to correctly work but no longer works topic:stdlib:text
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants