ruby-changes:43738
From: nobu <ko1@a...>
Date: Thu, 4 Aug 2016 11:54:38 +0900 (JST)
Subject: [ruby-changes:43738] nobu:r55811 (trunk): hash.c: set encoding
nobu 2016-08-04 11:54:32 +0900 (Thu, 04 Aug 2016) New Revision: 55811 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55811 Log: hash.c: set encoding * hash.c (env_assoc): the encoding of the value should be the locale, as well as other methods, [], fetch, values, etc. Modified files: trunk/ChangeLog trunk/hash.c trunk/test/ruby/test_env.rb Index: hash.c =================================================================== --- hash.c (revision 55810) +++ hash.c (revision 55811) @@ -3899,7 +3899,7 @@ env_assoc(VALUE env, VALUE key) https://github.com/ruby/ruby/blob/trunk/hash.c#L3899 s = env_name(key); e = getenv(s); - if (e) return rb_assoc_new(key, rb_tainted_str_new2(e)); + if (e) return rb_assoc_new(key, env_str_new2(e)); return Qnil; } Index: test/ruby/test_env.rb =================================================================== --- test/ruby/test_env.rb (revision 55810) +++ test/ruby/test_env.rb (revision 55811) @@ -319,6 +319,8 @@ class TestEnv < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_env.rb#L319 assert_equal("foo", v) end assert_invalid_env {|var| ENV.assoc(var)} + assert_predicate(v, :tainted?) + assert_equal(Encoding.find("locale"), v.encoding) end def test_has_value2 Index: ChangeLog =================================================================== --- ChangeLog (revision 55810) +++ ChangeLog (revision 55811) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Aug 4 11:54:30 2016 Nobuyoshi Nakada <nobu@r...> + + * hash.c (env_assoc): the encoding of the value should be the + locale, as well as other methods, [], fetch, values, etc. + Wed Aug 3 21:31:23 2016 Nobuyoshi Nakada <nobu@r...> * parse.y (reg_fragment_enc_error): compile_error is different -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/