mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
encoding.c: fix encoding of dynsym
* encoding.c (rb_enc_get_index): the encoding of dynamic symbol comes from fstr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2d8c3e7851
commit
e8de850e6d
2 changed files with 4 additions and 0 deletions
|
@ -747,6 +747,9 @@ rb_enc_get_index(VALUE obj)
|
||||||
obj = rb_id2str(SYM2ID(obj));
|
obj = rb_id2str(SYM2ID(obj));
|
||||||
}
|
}
|
||||||
switch (BUILTIN_TYPE(obj)) {
|
switch (BUILTIN_TYPE(obj)) {
|
||||||
|
case T_SYMBOL:
|
||||||
|
obj = RSYMBOL(obj)->fstr;
|
||||||
|
/* fall through */
|
||||||
as_default:
|
as_default:
|
||||||
default:
|
default:
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
|
|
|
@ -110,6 +110,7 @@ class TestEncoding < Test::Unit::TestCase
|
||||||
bin = "\xff".force_encoding(Encoding::ASCII_8BIT).to_sym
|
bin = "\xff".force_encoding(Encoding::ASCII_8BIT).to_sym
|
||||||
asc = "b".force_encoding(Encoding::ASCII_8BIT)
|
asc = "b".force_encoding(Encoding::ASCII_8BIT)
|
||||||
assert_equal(Encoding::ASCII_8BIT, Encoding.compatible?(bin, asc))
|
assert_equal(Encoding::ASCII_8BIT, Encoding.compatible?(bin, asc))
|
||||||
|
assert_equal(Encoding::UTF_8, Encoding.compatible?("\u{3042}".to_sym, ua.to_sym))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_errinfo_after_autoload
|
def test_errinfo_after_autoload
|
||||||
|
|
Loading…
Reference in a new issue