1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (io_getc): should be 7bit if ascii. fixes #4557

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-06-11 09:02:11 +00:00
parent 6f58118e4c
commit 34b19050b3
3 changed files with 14 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Sat Jun 11 18:02:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (io_getc): should be 7bit if ascii. fixes #4557
Sat Jun 11 16:52:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* numeric.c (rb_enc_uint_chr): fix message format. Bug#4869

2
io.c
View file

@ -2887,7 +2887,7 @@ io_getc(rb_io_t *fptr, rb_encoding *enc)
}
else {
io_shift_cbuf(fptr, MBCLEN_CHARFOUND_LEN(r), &str);
cr = ENC_CODERANGE_VALID;
cr = ISASCII(r) ? ENC_CODERANGE_7BIT : ENC_CODERANGE_VALID;
}
str = io_enc_str(str, fptr);
ENC_CODERANGE_SET(str, cr);

View file

@ -2060,5 +2060,14 @@ EOT
r.close
end)
end
def test_getc_ascii_only
bug4557 = '[ruby-core:35630]'
c = with_tmpdir {
open("a", "wb") {|f| f.puts "a"}
open("a", "rt") {|f| f.getc}
}
assert(c.ascii_only?, "should be ascii_only #{bug4557}")
end
end