Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make sure proper encoding set when using #read_nonblock
  • 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
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.