summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan <ethan@unth.net>2021-10-20 13:53:18 -0700
committerEthan <ethan@unth.net>2022-02-08 16:46:12 -0800
commit766f81657536fd629dc02dc34c489209c6db2a2e (patch)
tree53dd4bf54cd6106e02c26cf98ffec7ab8ae2907f
parent82fe866da296c5ab73157b85eebe0483b818ad8e (diff)
downloadjson-766f81657536fd629dc02dc34c489209c6db2a2e.tar.gz
fix parsing of unicode, mixing literal characters with escaped, by forcing encoding back to ASCII_8BIT before gsubing back into parse_string result
-rw-r--r--lib/json/pure/parser.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/json/pure/parser.rb b/lib/json/pure/parser.rb
index e1d701b..be48c60 100644
--- a/lib/json/pure/parser.rb
+++ b/lib/json/pure/parser.rb
@@ -179,7 +179,7 @@ module JSON
bytes << c[6 * i + 2, 2].to_i(16) << c[6 * i + 4, 2].to_i(16)
i += 1
end
- JSON.iconv('utf-8', 'utf-16be', bytes)
+ JSON.iconv('utf-8', 'utf-16be', bytes).force_encoding(::Encoding::ASCII_8BIT)
end
end
if string.respond_to?(:force_encoding)