summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-03 12:23:54 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-03 12:23:54 +0000
commit909a92ea6ddf476411c580c8e075dfd078a59ddc (patch)
tree817bbd7253704d2067e8cde5b69ad24d6e2be18f
parent6cdc9b6097ea907cdaf2f95c9e34f29676166046 (diff)
merges r32000 from trunk into ruby_1_9_2.
-- * io.c (io_getc): should be 7bit if ascii. fixes #4557 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@32380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--io.c2
-rw-r--r--test/ruby/test_io_m17n.rb9
-rw-r--r--version.h2
4 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 51543e9a29..5873dac0d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:28:25 2011 Kouhei Sutou <kou@cozmixng.org>
* lib/rexml/formatters/pretty.rb
diff --git a/io.c b/io.c
index dee458784a..065b165906 100644
--- a/io.c
+++ b/io.c
@@ -2851,7 +2851,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);
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index 39e6dd6538..ec51956155 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -2047,5 +2047,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
diff --git a/version.h b/version.h
index 79e005eebf..ac7dc379d2 100644
--- a/version.h
+++ b/version.h
@@ -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