Skip to content

Commit

Permalink
make sure proper encoding set when using #read_nonblock
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckremes committed Feb 9, 2016
1 parent c5db267 commit 94ff89a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2828,8 +2828,12 @@ def read_nonblock(size, buffer=nil, opts={})
end

if str
buffer.replace(str) if buffer
return str
if buffer
buffer.replace(str)
IO.read_encode(self, buffer)
else
IO.read_encode(self, str)
end
else
raise EOFError, "stream closed" unless opts[:exception] == false
end
Expand Down

0 comments on commit 94ff89a

Please sign in to comment.