{"action":"closed","issue":{"url":"https://api.github.com/repos/ingydotnet/pegex-json-pm/issues/3","repository_url":"https://api.github.com/repos/ingydotnet/pegex-json-pm","labels_url":"https://api.github.com/repos/ingydotnet/pegex-json-pm/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/ingydotnet/pegex-json-pm/issues/3/comments","events_url":"https://api.github.com/repos/ingydotnet/pegex-json-pm/issues/3/events","html_url":"https://github.com/ingydotnet/pegex-json-pm/issues/3","id":115418329,"node_id":"MDU6SXNzdWUxMTU0MTgzMjk=","number":3,"title":"This doesn't work correctly on surrogate pairs","user":{"login":"benkasminbullock","id":102005,"node_id":"MDQ6VXNlcjEwMjAwNQ==","avatar_url":"https://avatars0.githubusercontent.com/u/102005?v=4","gravatar_id":"","url":"https://api.github.com/users/benkasminbullock","html_url":"https://github.com/benkasminbullock","followers_url":"https://api.github.com/users/benkasminbullock/followers","following_url":"https://api.github.com/users/benkasminbullock/following{/other_user}","gists_url":"https://api.github.com/users/benkasminbullock/gists{/gist_id}","starred_url":"https://api.github.com/users/benkasminbullock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benkasminbullock/subscriptions","organizations_url":"https://api.github.com/users/benkasminbullock/orgs","repos_url":"https://api.github.com/users/benkasminbullock/repos","events_url":"https://api.github.com/users/benkasminbullock/events{/privacy}","received_events_url":"https://api.github.com/users/benkasminbullock/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2015-11-06T01:59:19Z","updated_at":"2018-10-23T23:16:52Z","closed_at":"2018-10-23T23:16:52Z","author_association":"NONE","body":"<pre>\nuse warnings;\nuse strict;\nuse utf8;\nuse FindBin '$Bin';\nuse Pegex::JSON;\nuse Test::More;\n# This contains the surrogate pair for U+10437\nmy $wikipedia_1 = '[\"\\ud801\\udc37\"]';\nmy $data = Pegex::JSON->new->load ($wikipedia_1);\nis ($data->[0], \"\\x{10437}\");\n# This does not contain any surrogate pairs\nmy $not_surrogate_pair = '[\"\\u8d64\\u30d6\\u00f6\\uff21\\u2100\"]';\nmy $data2 = Pegex::JSON->new->load ($not_surrogate_pair);\ncmp_ok (length ($data2), '==', 5);\ndone_testing ();\n</pre>\n\n\nThe code within Pegex JSON is definitely wrong.\n\nI don't have a fix, but there is pure perl code for surrogate pairs within Mojo::JSON:\n\nhttps://metacpan.org/source/SRI/Mojolicious-6.29/lib/Mojo/JSON.pm#L157\n\nIf you want more tests for surrogate pairs you are welcome to filch these:\n\nhttps://metacpan.org/source/BKB/JSON-Parse-0.38/t/unicode.t#L74\n"}}
{"actor":{"display_login":"benkasminbullock"}}