diff --git a/io.c b/io.c index 1b9124134e..c72caae3b9 100644 --- a/io.c +++ b/io.c @@ -2095,14 +2095,15 @@ rb_io_write_nonblock(VALUE io, VALUE str) * * Reads length bytes from the I/O stream. * - * length must be a non-negative integer or nil. + * length must be a non-negative integer or nil. * * If length is a positive integer, - * it try to read length bytes. - * It returns nil or a string which length is 1 to length bytes. - * nil means it met EOF at beginning. + * it try to read length bytes without any conversion (binary mode). + * It returns nil or a string whose length is 1 to length bytes. + * nil means it met EOF at beginning. * The 1 to length-1 bytes string means it met EOF after reading the result. * The length bytes string means it doesn't meet EOF. + * The resulted string is always ASCII-8BIT encoding. * * If length is omitted or is nil, * it reads until EOF and the encoding conversion is applied. @@ -2117,7 +2118,7 @@ rb_io_write_nonblock(VALUE io, VALUE str) * depend on length. * ios.read() and * ios.read(nil) returns "". - * ios.read(positive-integer) returns nil. + * ios.read(positive-integer) returns nil. * * f = File.new("testfile") * f.read(16) #=> "This is line one"