"\xFF" 1.9.3p286 :002 > b = "\x98".force_encoding 'us-ascii' => "\x98" 1.9.3p286 :003 > a + b Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and US- ASCII Thursday, November 1, 2012
[x86_64-apple-darwin10.8.0] StringIO#gets when passed [separator] - returns the data read till the next occurence of the passed separator - sets $_ to the read content - accepts string as separator - updates self's lineno by one - returns the next paragraph when the passed separator is an empty String - returns the remaining content starting at the current position when passed nil - tries to convert the passed separator to a String using #to_str StringIO#gets when passed no argument - returns the data read till the next occurence of $/ or till eof - sets $_ to the read content - updates self's position - updates self's lineno - returns nil if self is at the end StringIO#gets when passed [limit] - returns the data read until the limit is met - sets $_ to the read content - updates self's lineno by one - tries to convert the passed limit to an Integer using #to_int - returns a blank string when passed a limit of 0 StringIO#gets when passed [separator] and [limit] - returns the data read until the limit is consumed or the separator is met - sets $_ to the read content - updates self's lineno by one - tries to convert the passed separator to a String using #to_str - does not raise TypeError if passed separator is nil - tries to convert the passed limit to an Integer using #to_int - raises a TypeError if both separator and limit are nil StringIO#gets when in write-only mode - raises an IOError Thursday, November 1, 2012