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

Call write directly rather than through stream #6587

Merged
merged 1 commit into from
Mar 1, 2021

Conversation

headius
Copy link
Member

@headius headius commented Mar 1, 2021

The OutputStream returned by RubyIO.getOutputStream encodes all
strings as ASCII-8BIT which makes it incompatible with any IO that
has an incompatible external encoding. That is a separate bug, but
it affects uses of IOOutputStream that should be ok.

IOOutputStream aggregates an encoding to use, so it should be able
to pass properly-encoded strings through to the IO. This change
avoids using the stream from getOutputStream and instead calls
RubyIO.write directly.

This fixes the ASCII-8BIT failure noted in ruby/psych#481.

The OutputStream returned by RubyIO.getOutputStream encodes all
strings as ASCII-8BIT which makes it incompatible with any IO that
has an incompatible external encoding. That is a separate bug, but
it affects uses of IOOutputStream that should be ok.

IOOutputStream aggregates an encoding to use, so it should be able
to pass properly-encoded strings through to the IO. This change
avoids using the stream from getOutputStream and instead calls
RubyIO.write directly.

This fixes the ASCII-8BIT failure noted in ruby/psych#481.
@headius headius added this to the JRuby 9.2.16.0 milestone Mar 1, 2021
@headius headius merged commit 7810923 into jruby:jruby-9.2 Mar 1, 2021
@headius headius deleted the io_outputstream_encoding branch March 1, 2021 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant