diff options
author | Florian Frank <flori@ping.de> | 2012-06-01 14:16:36 +0200 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2012-06-01 14:16:36 +0200 |
commit | d76588541a65fd7c56e5c990fb7ba39eabeef277 (patch) | |
tree | f2534e1b155fc13415ab2c6cdac35dee5406952e /tests | |
parent | c1320061ae68a4695d72ce287373ff1e2e2f0022 (diff) | |
download | json-raise-error-on-invalid-utf8.tar.gz |
Always raise an error on invalid UTF-8raise-error-on-invalid-utf8
This concerns strings that were tagged as UTF-8, but actually aren't.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_json_unicode.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_json_unicode.rb b/tests/test_json_unicode.rb index c328811..66a87d0 100755 --- a/tests/test_json_unicode.rb +++ b/tests/test_json_unicode.rb @@ -69,4 +69,11 @@ class TestJSONUnicode < Test::Unit::TestCase end assert_equal "\302\200", JSON.parse('["\u0080"]').first end + + def test_parsing_invalid_utf8 + assert_raise ArgumentError do + JSON.parse "[\"\xCE\"]", :quirks_mode => true + JSON.parse "[\"\xCE\"]" + end + end end |