https://github.com/plentz/jruby_report/blob/master/ok_json_test.rb
~/Projects/opensource/jruby_report (master) $ ruby -I. ok_json_test.rb
Run options: --seed 31809
# Running tests:
"\xEF\xBF\xBD"
..F
Finished tests in 0.049639s, 60.4364 tests/s, 60.4364 assertions/s.
1) Failure:
test_json_encode(OkJsonTest) [ok_json_test.rb:14]:
Expected: "{\"message\":\"á\"}"
Actual: "{\"message\":\"\\ufffd\"}"
3 tests, 3 assertions, 1 failures, 0 errors, 0 skips
to this
~/Projects/opensource/jruby_report (master) $ ruby -I. ok_json_test.rb
Run options: --seed 3567
# Running tests:
.FF
Finished tests in 0.028424s, 105.5446 tests/s, 105.5446 assertions/s.
1) Failure:
test_decode_bad(OkJsonTest) [ok_json_test.rb:24]:
Expected: "\xEF\xBF\xBD"
Actual: "�"
2) Failure:
test_json_encode(OkJsonTest) [ok_json_test.rb:14]:
Expected: "{\"message\":\"á\"}"
Actual: "{\"message\":\"\\u00e1\"}"
3 tests, 3 assertions, 2 failures, 0 errors, 0 skips
~/Projects/opensource/jruby_report (master) $ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
Forgot what I've said. Just found this: http://tools.ietf.org/html/rfc4627#section-2.5
Any character *may* be escaped.
So both are correct. Right?