diff options
author | Florian Frank <flori@ping.de> | 2016-06-03 13:54:40 +0200 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2016-06-03 19:48:15 +0200 |
commit | cf466b8d4e4afe9af313e5c8bea4e97ef3170637 (patch) | |
tree | 99dd1238c50be4d21278bd876709df319f045f84 /tests | |
parent | 7f6b0e3766a83a05aa7bf8351be5e3b478d5b7a6 (diff) | |
download | json-cf466b8d4e4afe9af313e5c8bea4e97ef3170637.tar.gz |
Treat ASCII_8BIT as UTF-8 by default
Diffstat (limited to 'tests')
-rw-r--r-- | tests/json_encoding_test.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/json_encoding_test.rb b/tests/json_encoding_test.rb index f8b88d2..d983e12 100644 --- a/tests/json_encoding_test.rb +++ b/tests/json_encoding_test.rb @@ -5,9 +5,10 @@ class JSONEncodingTest < Test::Unit::TestCase include JSON def setup - @utf_8 = '"© ≠ €!"' - @parsed = "© ≠ €!" - @generated = '"\u00a9 \u2260 \u20ac!"' + @utf_8 = '"© ≠ €!"' + @ascii_8bit = @utf_8.dup.force_encoding('ascii-8bit') + @parsed = "© ≠ €!" + @generated = '"\u00a9 \u2260 \u20ac!"' if String.method_defined?(:encode) @utf_16_data = @parsed.encode('utf-16be', 'utf-8') @utf_16be = @utf_8.encode('utf-16be', 'utf-8') @@ -25,6 +26,7 @@ class JSONEncodingTest < Test::Unit::TestCase end def test_parse + assert_equal @parsed, JSON.parse(@ascii_8bit) assert_equal @parsed, JSON.parse(@utf_8) assert_equal @parsed, JSON.parse(@utf_16be) assert_equal @parsed, JSON.parse(@utf_16le) |