ruby-changes:33357
From: nobu <ko1@a...>
Date: Wed, 26 Mar 2014 17:24:20 +0900 (JST)
Subject: [ruby-changes:33357] nobu:r45436 (trunk): encoding.c: enc_capable symbol
nobu 2014-03-26 17:24:09 +0900 (Wed, 26 Mar 2014) New Revision: 45436 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45436 Log: encoding.c: enc_capable symbol * encoding.c (enc_capable): Symbol is now encoding capable. Modified files: trunk/encoding.c trunk/test/ruby/test_encoding.rb Index: encoding.c =================================================================== --- encoding.c (revision 45435) +++ encoding.c (revision 45436) @@ -720,6 +720,7 @@ enc_capable(VALUE obj) https://github.com/ruby/ruby/blob/trunk/encoding.c#L720 case T_STRING: case T_REGEXP: case T_FILE: + case T_SYMBOL: return TRUE; case T_DATA: if (is_data_encoding(obj)) return TRUE; Index: test/ruby/test_encoding.rb =================================================================== --- test/ruby/test_encoding.rb (revision 45435) +++ test/ruby/test_encoding.rb (revision 45436) @@ -107,6 +107,9 @@ class TestEncoding < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_encoding.rb#L107 bin = "a".force_encoding(Encoding::ASCII_8BIT) asc = "b".force_encoding(Encoding::US_ASCII) assert_equal(Encoding::ASCII_8BIT, Encoding.compatible?(bin, asc)) + bin = "\xff".force_encoding(Encoding::ASCII_8BIT).to_sym + asc = "b".force_encoding(Encoding::ASCII_8BIT) + assert_equal(Encoding::ASCII_8BIT, Encoding.compatible?(bin, asc)) end def test_errinfo_after_autoload -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/