celluloid/celluloid-io — pull request #24 by cesare (2012-09-07 13:56:12+00:00)
Title: Fix #read and #readpartial to return ASCII-8BIT string

Hi,

IO#read and #readpartial are supposed to return a string in ASCII-8BIT encoding, whereas those methods of Celluloid::IO::TCPSocket return an US-ASCII string.
(See http://www.ruby-doc.org/core-1.9.3/IO.html#method-i-read for details)

I ran across this issue while using RubyAMI library, which depends on Celluloid::IO. It parses strings generated by the #readpartial, and examines characters in the string one by one, using String#ord. But #ord raises error if the string is an US-ASCII one and the examined character is not in US-ASCII range (something like UTF-8 characters, for example).

This patch fixes this issue by forcing ASCII-8BIT encoding.
Could you check this out and merge it into your product?

Thank you in advance