diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-08 01:55:14 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-08 01:55:14 +0000 |
commit | a3fe92fae99f8f7a15e0c850dca87485fe8e523a (patch) | |
tree | 76c724d0f0e184d007e4326693775cb652a75318 /io.c | |
parent | f8abe7d4942d60a19beabe57c3c734dfc33a47ff (diff) | |
download | ruby-a3fe92fae99f8f7a15e0c850dca87485fe8e523a.tar.gz |
io.c: [DOC] IO#gets [skip ci]
* io.c (rb_io_gets_m): Update IO#gets doc for characters more than
1 byte. [Fix GH-1085]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -3291,6 +3291,16 @@ rb_io_gets(VALUE io) * * File.new("testfile").gets #=> "This is line one\n" * $_ #=> "This is line one\n" + * + * If StringIO contains characters more than 1 byte + * then <code>gets(1)</code> returns character entirely: + * + * # russian characters take 2 bytes + * File.write("testfile", "\u{442 435 441 442}") + * File.open("testfile") {|f|f.gets(1)} #=> "\u0442" + * File.open("testfile") {|f|f.gets(2)} #=> "\u0442" + * File.open("testfile") {|f|f.gets(3)} #=> "\u0442\u0435" + * File.open("testfile") {|f|f.gets(4)} #=> "\u0442\u0435" */ static VALUE |