Skip to content

Call write directly rather than through stream#6587

Merged
headius merged 1 commit intojruby:jruby-9.2from
headius:io_outputstream_encoding
Mar 1, 2021
Merged

Call write directly rather than through stream#6587
headius merged 1 commit intojruby:jruby-9.2from
headius:io_outputstream_encoding

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