ruby-changes:72835
From: Alan <ko1@a...>
Date: Sat, 6 Aug 2022 03:34:25 +0900 (JST)
Subject: [ruby-changes:72835] f1057393da (master): [DOC] Clarify that `IO.read` uses text mode
https://git.ruby-lang.org/ruby.git/commit/?id=f1057393da From f1057393da7a98e447ee7679db69aeec8f4d1650 Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> Date: Wed, 3 Aug 2022 10:47:12 -0400 Subject: [DOC] Clarify that `IO.read` uses text mode See: https://bugs.ruby-lang.org/issues/18882#note-13 [Bug #18882] --- io.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/io.c b/io.c index 1fe9278957..c91899a6fe 100644 --- a/io.c +++ b/io.c @@ -11776,12 +11776,16 @@ seek_before_access(VALUE argp) https://github.com/ruby/ruby/blob/trunk/io.c#L11776 * IO.read('| cat t.txt') * # => "First line\nSecond line\n\nThird line\nFourth line\n" * - * With only argument +path+ given, reads and returns the entire content + * With only argument +path+ given, reads in text mode and returns the entire content * of the file at the given path: * * IO.read('t.txt') * # => "First line\nSecond line\n\nThird line\nFourth line\n" * + * On Windows, text mode can terminate reading and leave bytes in the file + * unread when encountering certain special bytes. Consider using + * IO.binread if all bytes in the file should be read. + * * For both forms, command and path, the remaining arguments are the same. * * With argument +length+, returns +length+ bytes if available: -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/