From bb1d0d280781b6bf0b9798f8603208c2ef8b1459 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 26 Mar 2014 11:30:54 +0000 Subject: [PATCH] parse.y: set encoding * parse.y (rb_str_dynamic_intern): associate proper encoding with the result symbol. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- encoding.c | 3 --- parse.y | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/encoding.c b/encoding.c index b1afc87bd2..df3d65cd48 100644 --- a/encoding.c +++ b/encoding.c @@ -747,9 +747,6 @@ rb_enc_get_index(VALUE obj) obj = rb_id2str(SYM2ID(obj)); } switch (BUILTIN_TYPE(obj)) { - case T_SYMBOL: - obj = RSYMBOL(obj)->fstr; - /* fall through */ as_default: default: case T_STRING: diff --git a/parse.y b/parse.y index a9a2aac33d..1977a5fd04 100644 --- a/parse.y +++ b/parse.y @@ -10685,12 +10685,14 @@ rb_str_dynamic_intern(VALUE str) str = rb_str_dup(str); rb_enc_associate(str, ascii); OBJ_FREEZE(str); + enc = ascii; } } type = rb_str_symname_type(str, IDSET_ATTRSET_FOR_INTERN); str = rb_fstring(str); dsym = rb_newobj_of(rb_cSymbol, T_SYMBOL); + rb_enc_associate(dsym, enc); OBJ_FREEZE(dsym); RSYMBOL(dsym)->fstr = str; RSYMBOL(dsym)->type = type;