Project

General

Profile

This project is closed and read-only.

Actions

Bug #912

closed

Confusion over encoding returned by IO#read & IO.read

Bug #912: Confusion over encoding returned by IO#read & IO.read

Added by mike (Michael Selig) over 17 years ago. Updated over 15 years ago.


Description

=begin
I find it confusing that IO#read & IO.read return an ASCII-8BIT string when a length is specified, but not when the entire file is read (no length specified).

Given that we have "binread" to read binary data, why not make "read(length)" work like gets("", length) so it consistently returns the encoding?
=end


Related issues 1 (0 open1 closed)

Related to Ruby - Feature #908: Should be an easy way of reading N characters from am I/O streamRejectedakr (Akira Tanaka)Actions

Updated by shyouhei (Shyouhei Urabe) over 17 years ago Actions #1

  • Assignee set to matz (Yukihiro Matsumoto)
  • ruby -v set to 1.9.1

=begin

=end

Updated by naruse (Yui NARUSE) over 16 years ago Actions #2

  • Status changed from Open to Rejected

=begin
It is intended.

IO#read(bytesize) / IO.read(bytesize) is binary method.
So its argument is bytesize and it specify ASCII-8BIT.

If you want a read character method, Feature #908 is related ticket.
=end

Actions

Also available in: PDF Atom