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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
18cf70ebf6
commit
9e1b9b9c8f
@ -1,3 +1,8 @@
|
|||||||
|
Thu Aug 4 11:54:30 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@ruby-lang.org>
|
Wed Aug 3 21:31:23 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* parse.y (reg_fragment_enc_error): compile_error is different
|
* parse.y (reg_fragment_enc_error): compile_error is different
|
||||||
|
2
hash.c
2
hash.c
@ -3899,7 +3899,7 @@ env_assoc(VALUE env, VALUE key)
|
|||||||
|
|
||||||
s = env_name(key);
|
s = env_name(key);
|
||||||
e = getenv(s);
|
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;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,6 +319,8 @@ class TestEnv < Test::Unit::TestCase
|
|||||||
assert_equal("foo", v)
|
assert_equal("foo", v)
|
||||||
end
|
end
|
||||||
assert_invalid_env {|var| ENV.assoc(var)}
|
assert_invalid_env {|var| ENV.assoc(var)}
|
||||||
|
assert_predicate(v, :tainted?)
|
||||||
|
assert_equal(Encoding.find("locale"), v.encoding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_has_value2
|
def test_has_value2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user