summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/psych/parser.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/psych/parser.c b/ext/psych/parser.c
index 76ca4dd..f028447 100644
--- a/ext/psych/parser.c
+++ b/ext/psych/parser.c
@@ -177,9 +177,11 @@ static VALUE parse(VALUE self, VALUE yaml)
break;
case YAML_SEQUENCE_START_EVENT:
{
- VALUE anchor = event.data.sequence_start.anchor ?
- rb_str_new2((const char *)event.data.sequence_start.anchor) :
- Qnil;
+ VALUE anchor = Qnil;
+ if(event.data.sequence_start.anchor) {
+ anchor = rb_str_new2((const char *)event.data.sequence_start.anchor);
+ rb_enc_associate_index(anchor, encoding);
+ }
VALUE tag = Qnil;
if(event.data.sequence_start.tag) {