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

Expose rb_str_append as String#append and special case BINARY encoded buffers. #1926

Closed
wants to merge 5 commits into from

Conversation

ioquatix
Copy link
Member

Please see https://bugs.ruby-lang.org/issues/14975 for discussion.

@ioquatix
Copy link
Member Author

@nobu @ko1 do you mind giving me feedback? Thanks :)

{
StringValue(str2);

if (RB_ENCODING_IS_ASCII8BIT(str) || ENCODING_GET(str) == ENCODING_GET(str2)) {
Copy link
Member

Choose a reason for hiding this comment

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

That check is too simple, it should be something like "is str encoding's a superset of str2's encoding?".
e.g. it's fine to append US-ASCII to UTF-8.

Copy link
Member

Choose a reason for hiding this comment

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

Or alternatively make this method only work on binary strings and name it byteappend (see issue).

@k0kubun k0kubun changed the base branch from trunk to master August 15, 2019 17:34
@ioquatix
Copy link
Member Author

IO::Buffer makes this less important.

@ioquatix ioquatix closed this Dec 21, 2021
@ioquatix ioquatix deleted the string-append branch December 21, 2021 19:21
@ioquatix ioquatix restored the string-append branch December 21, 2021 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants