timo / json_fast

a naive imperative json parser in perl6, to evaluate performance against JSON::Tiny
Artistic License 2.0
27 stars 20 forks source link

JSON::Fast fails to encode complex UTF #33

Closed ghost closed 7 years ago

ghost commented 7 years ago

Given the following input: {"update_id":109911583, "message":{"message_id":1228,"from":{"id":116204011,"is_bot":false,"first_name":"Someone","last_name":"Unknown \ud83c\udded\ud83c\uddf7","username":"s0me0ne","language_code":"en"},"chat":{"id":116204011,"first_name":"Someone","last_name":"Unknown \ud83c\udded\ud83c\uddf7","username":"s0me0ne","type":"private"},"date":1511035180,"text":"\u0444\u044b\u0432"}}

JSON::Fast::from-json produces an error:

Error encoding UTF-8 string: could not encode Unicode Surrogate codepoint 55356 (0xD83C)

While JSON::Tiny produces the correct result.