Issue #6436 has been reported by jcast (Jeremie Castagna).

----------------------------------------
Bug #6436: Byte counting incorrect in BufferedIO (net/protocol.rb)
https://bugs.ruby-lang.org/issues/6436

Author: jcast (Jeremie Castagna)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: 1.9


BufferedIO's @rbuf counts bytes with String#size, but should use String#bytesize. This creates potential incorrect reading of a HTTP body when changing the encoding of each chuck passed by HTTP#read_body:

http.read_body do |chunk|
  chunk.force_encoding "UTF-8"
end


-- 
http://bugs.ruby-lang.org/