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#insert not working with non-ascii Char #4164

Merged
merged 1 commit into from Mar 20, 2017

Conversation

Papierkorb
Copy link
Contributor

Previously, String#insert did not check if the Char to insert was ASCII
or not. This resulted in a String which thought it was ascii_only?

Example:

good = "ä"
broken = "".insert(0, 'ä')

pp good == broken #=> true, as expected
pp good.ascii_only? == broken.ascii_only? #=> false, but expected true
pp good.size, broken.size, good.bytesize, broken.bytesize
# As bytesize == size, ascii_only? returns true for the broken one

Previously, String#insert did not check if the Char to insert was ASCII
or not.  This resulted in a String which thought it was `ascii_only?`
@bcardiff bcardiff added this to the Next milestone Mar 20, 2017
@bcardiff bcardiff merged commit 4754104 into crystal-lang:master Mar 20, 2017
@bcardiff
Copy link
Member

Thanks @Papierkorb. Good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants