From 91538a3882bcb23f9f93f7738da34d4370f54558 Mon Sep 17 00:00:00 2001 From: knu Date: Wed, 5 Jun 2013 15:05:48 +0000 Subject: [PATCH] * string.c (String#b): Allow code range scan to happen later so ascii_only? on a result string returns the correct value. [ruby-core:55315] [Bug #8496] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ string.c | 2 +- test/ruby/test_m17n.rb | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0cb44ddd54..6700e1f6f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Jun 6 00:05:08 2013 Akinori MUSHA + + * string.c (String#b): Allow code range scan to happen later so + ascii_only? on a result string returns the correct value. + [ruby-core:55315] [Bug #8496] + Wed Jun 5 22:40:42 2013 Shugo Maeda * lib/net/imap.rb (capability_response): should ignore trailing diff --git a/string.c b/string.c index 6aeb029f2f..4111e963c7 100644 --- a/string.c +++ b/string.c @@ -7624,7 +7624,7 @@ rb_str_b(VALUE str) VALUE str2 = str_alloc(rb_cString); str_replace_shared_without_enc(str2, str); OBJ_INFECT(str2, str); - ENC_CODERANGE_SET(str2, ENC_CODERANGE_VALID); + ENC_CODERANGE_CLEAR(str2); return str2; } diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 98f79b3f76..edc8e4c28f 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1488,6 +1488,8 @@ class TestM17N < Test::Unit::TestCase assert_equal(true, s.b.tainted?) s.untrust assert_equal(true, s.b.untrusted?) + s = "abc".b + assert_equal(true, s.b.ascii_only?) end def test_scrub