ruby-changes:20332
From: yugui <ko1@a...>
Date: Sun, 3 Jul 2011 21:24:20 +0900 (JST)
Subject: [ruby-changes:20332] yugui:r32380 (ruby_1_9_2): merges r32000 from trunk into ruby_1_9_2.
yugui 2011-07-03 21:23:54 +0900 (Sun, 03 Jul 2011) New Revision: 32380 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32380 Log: merges r32000 from trunk into ruby_1_9_2. -- * io.c (io_getc): should be 7bit if ascii. fixes #4557 Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/io.c branches/ruby_1_9_2/test/ruby/test_io_m17n.rb branches/ruby_1_9_2/version.h Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 32379) +++ ruby_1_9_2/ChangeLog (revision 32380) @@ -1,3 +1,7 @@ +Sat Jun 11 18:02:09 2011 Nobuyoshi Nakada <nobu@r...> + + * io.c (io_getc): should be 7bit if ascii. fixes #4557 + Sat Jun 11 16:28:25 2011 Kouhei Sutou <kou@c...> * lib/rexml/formatters/pretty.rb Index: ruby_1_9_2/io.c =================================================================== --- ruby_1_9_2/io.c (revision 32379) +++ ruby_1_9_2/io.c (revision 32380) @@ -2851,7 +2851,7 @@ } 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); Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 32379) +++ ruby_1_9_2/version.h (revision 32380) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 279 +#define RUBY_PATCHLEVEL 280 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 Index: ruby_1_9_2/test/ruby/test_io_m17n.rb =================================================================== --- ruby_1_9_2/test/ruby/test_io_m17n.rb (revision 32379) +++ ruby_1_9_2/test/ruby/test_io_m17n.rb (revision 32380) @@ -2047,5 +2047,14 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/