summaryrefslogtreecommitdiff
path: root/test/json/json_generator_test.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-14 19:13:20 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-14 19:54:48 +0900
commit2003755a2c491fd81496308cad97ce6304c51fe8 (patch)
tree348e080cb58bbe60c69e8cd8119276bac4331567 /test/json/json_generator_test.rb
parentd7fa7e2c860430a3dfa1b08be96734925b6c81d8 (diff)
[flori/json] Fixed unexpected illegal/malformed utf-8 error
flori/json@c34d01ff6a18dac04a90b2e0f820cdb1d5c7e1b2 does not consider US-ASCII compatible but non-UTF-8 encodings, and causes an error in RDoc tests. https://github.com/flori/json/commit/4f471bf590
Diffstat (limited to 'test/json/json_generator_test.rb')
-rw-r--r--test/json/json_generator_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/json/json_generator_test.rb b/test/json/json_generator_test.rb
index 86be398..d7f9ebe 100644
--- a/test/json/json_generator_test.rb
+++ b/test/json/json_generator_test.rb
@@ -374,4 +374,10 @@ EOT
assert_equal '["foo"]', JSON.generate([s.new('foo')])
end
end
+
+ if defined?(Encoding)
+ def test_nonutf8_encoding
+ assert_equal("\"5\u{b0}\"", "5\xb0".force_encoding("iso-8859-1").to_json)
+ end
+ end
end