jsonb-api icon indicating copy to clipboard operation
jsonb-api copied to clipboard

Character Encoding

Open martijndwars opened this issue 5 years ago • 1 comments
trafficstars

The JSON-B specification mentions "Instances of [...] java.lang.Character are serialized to JSON String values as defined within RFC 7159 Section 7 (Strings)". The RFC (https://tools.ietf.org/html/rfc7159#section-7) mentions that "All Unicode characters may be placed within the quotation marks, except for the characters that must be escaped: quotation mark, reverse solidus, and the control characters (U+0000 through U+001F)."

Now the problem is that there is a TCK test BasicJavaTypesMappingTest#testCharacterMapping that tests that Character.MAX_VALUE (= '\uFFFF') is escaped. U+FFFF falls outside of U+0000 through U+001F, so I assume that this character does not need to be escaped. Does that mean that the test is making a stronger assumption than necessary?

martijndwars avatar Mar 14 '20 17:03 martijndwars

Yes, I think the TCK test could be loosened a bit. RFC 2159 says that U+0000 through U+001F MUST be escaped, but the entire range (U+0000 through U+FFFF) MAY be escaped.

aguibert avatar Mar 15 '20 01:03 aguibert