summaryrefslogtreecommitdiff
path: root/ext/json/parser/parser.rl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-08 07:40:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-08 07:40:41 +0000
commit4902ef7d591fb01f6c9f70ec194e147c47935541 (patch)
tree223abaa69bf0f3a4effee7e478b95c471e09ae68 /ext/json/parser/parser.rl
parentb16fd08622a5b79259c7af22ef2ce8b06652d79e (diff)
* ext/json/parser/parser.rl (convert_encoding): should not modify
the argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/json/parser/parser.rl')
-rw-r--r--ext/json/parser/parser.rl1
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl
index abd056f..07319a8 100644
--- a/ext/json/parser/parser.rl
+++ b/ext/json/parser/parser.rl
@@ -549,6 +549,7 @@ static VALUE convert_encoding(VALUE source)
} else if (len >= 4 && ptr[1] == 0 && ptr[3] == 0) {
source = rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_16LE);
} else {
+ source = rb_str_dup(source);
FORCE_UTF8(source);
}
} else {