Skip to content

Commit 34a7a91

Browse files
committed
Fix the encoding of the backend string with StringIO.new
* #set_encoding would check @writable which is not set yet in the constructor.
1 parent f05b7df commit 34a7a91

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/truffle/stringio.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ def self.open(*args)
6969

7070
def initialize(string=nil, mode=nil)
7171
if string.nil?
72-
@__data__ = Data.new ''
73-
set_encoding(nil)
72+
@__data__ = Data.new ''.force_encoding(Encoding.default_external)
7473
mode = IO::RDWR
7574
else
7675
string = Truffle::Type.coerce_to string, String, :to_str

0 commit comments

Comments
 (0)