mochi/mochiweb

Fail to serialize utf-8 json with U+FFFE and U+FFFF

ermouth opened this issue · 5 comments

https://github.com/mochi/mochiweb/blob/master/src/mochijson2.erl#L310

This fails to convert U+FFFE and U+FFFF chars since xmerl_ucs assumes them non-valid. They are indeed forbidden in xml but clearly allowed in json.

Clearly allowed in JSON? Could you provide a reference for that?

I'm going to be on vacation for the next few weeks and likely won't have a chance to look into this, but I'd make the time to review a PR for this if one comes in (if it has a some tests to ensure it works for both literal and escaped input of these code points).

Found some time on the plane to do it

Thank you )