Skip to content

Commit

Permalink
Fix forgotten force_encoding call
Browse files Browse the repository at this point in the history
  • Loading branch information
DataWraith committed Jun 29, 2024
1 parent b07dc80 commit 6872327
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ascii85.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def encode(str_or_io, wrap_lines = 80, out: nil)
end

# If no output IO-object was provided, extract the encoded String from the
# default StringIO writer.
# default StringIO writer. We force the encoding to 'ASCII-8BIT' to work
# around a TruffleRuby bug.
return writer.finish.io.string.force_encoding('ASCII-8BIT') if out.nil?

# Otherwise we make sure to flush the output writer, and then return it.
Expand Down Expand Up @@ -299,7 +300,7 @@ def decode_raw(str_or_io, out: nil)
bufwriter.write(((word >> 8) & 0xff).chr) if count == 3
bufwriter.flush

out || bufwriter.io.string
out || bufwriter.io.string.force_encoding('ASCII-8BIT')
end

private
Expand Down

0 comments on commit 6872327

Please sign in to comment.