{"action":"created","issue":{"url":"https://api.github.com/repos/ceph/ceph/issues/4527","labels_url":"https://api.github.com/repos/ceph/ceph/issues/4527/labels{/name}","comments_url":"https://api.github.com/repos/ceph/ceph/issues/4527/comments","events_url":"https://api.github.com/repos/ceph/ceph/issues/4527/events","html_url":"https://github.com/ceph/ceph/pull/4527","id":72468556,"number":4527,"title":"json_spirit: use utf8 intenally when parsing \\uHHHH","user":{"login":"tserong","id":754700,"avatar_url":"https://avatars.githubusercontent.com/u/754700?v=3","gravatar_id":"","url":"https://api.github.com/users/tserong","html_url":"https://github.com/tserong","followers_url":"https://api.github.com/users/tserong/followers","following_url":"https://api.github.com/users/tserong/following{/other_user}","gists_url":"https://api.github.com/users/tserong/gists{/gist_id}","starred_url":"https://api.github.com/users/tserong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tserong/subscriptions","organizations_url":"https://api.github.com/users/tserong/orgs","repos_url":"https://api.github.com/users/tserong/repos","events_url":"https://api.github.com/users/tserong/events{/privacy}","received_events_url":"https://api.github.com/users/tserong/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ceph/ceph/labels/bug%20fix","name":"bug fix","color":"e11d21"},{"url":"https://api.github.com/repos/ceph/ceph/labels/common","name":"common","color":"006b75"}],"state":"closed","locked":false,"assignee":{"login":"tchaikov","id":59071,"avatar_url":"https://avatars.githubusercontent.com/u/59071?v=3","gravatar_id":"","url":"https://api.github.com/users/tchaikov","html_url":"https://github.com/tchaikov","followers_url":"https://api.github.com/users/tchaikov/followers","following_url":"https://api.github.com/users/tchaikov/following{/other_user}","gists_url":"https://api.github.com/users/tchaikov/gists{/gist_id}","starred_url":"https://api.github.com/users/tchaikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tchaikov/subscriptions","organizations_url":"https://api.github.com/users/tchaikov/orgs","repos_url":"https://api.github.com/users/tchaikov/repos","events_url":"https://api.github.com/users/tchaikov/events{/privacy}","received_events_url":"https://api.github.com/users/tchaikov/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2015-05-01T16:28:27Z","updated_at":"2015-05-08T04:38:25Z","closed_at":"2015-05-06T14:29:36Z","pull_request":{"url":"https://api.github.com/repos/ceph/ceph/pulls/4527","html_url":"https://github.com/ceph/ceph/pull/4527","diff_url":"https://github.com/ceph/ceph/pull/4527.diff","patch_url":"https://github.com/ceph/ceph/pull/4527.patch"},"body":"When the python CLI is given non-ASCII characters, it converts them to\r\n\\uHHHH escapes in JSON.  json_spirit parses these internally into 16 bit\r\ncharacters, which could only work if json_spirit were built to use\r\nstd::wstring, which it isn't; it's using std::string, so the high byte\r\nends up being zero'd, leaving the low byte which is effectively garbage.\r\n\r\nThis hack^H^H^H^H change makes json_spirit convert to utf8 internally\r\ninstead, which can be stored just fine inside a std::string.\r\n\r\nNote that this implementation still assumes \\uHHHH escapes are four hex\r\ndigits, so it'll only cope with characters in the Basic Multilingual\r\nPlane.  Still, that's rather a lot more characters than it could cope\r\nwith before ;)\r\n\r\n(For characters outside the BMP, Python seems to generate escapes in the\r\nform \\uHHHHHHHH, i.e. 8 hex digits, which the current implementation\r\ndoesn't expect to see)\r\n\r\nFixes: #7387\r\n\r\nSigned-off-by: Tim Serong <tserong@suse.com>"},"comment":{"url":"https://api.github.com/repos/ceph/ceph/issues/comments/100098551","html_url":"https://github.com/ceph/ceph/pull/4527#issuecomment-100098551","issue_url":"https://api.github.com/repos/ceph/ceph/issues/4527","id":100098551,"user":{"login":"tserong","id":754700,"avatar_url":"https://avatars.githubusercontent.com/u/754700?v=3","gravatar_id":"","url":"https://api.github.com/users/tserong","html_url":"https://github.com/tserong","followers_url":"https://api.github.com/users/tserong/followers","following_url":"https://api.github.com/users/tserong/following{/other_user}","gists_url":"https://api.github.com/users/tserong/gists{/gist_id}","starred_url":"https://api.github.com/users/tserong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tserong/subscriptions","organizations_url":"https://api.github.com/users/tserong/orgs","repos_url":"https://api.github.com/users/tserong/repos","events_url":"https://api.github.com/users/tserong/events{/privacy}","received_events_url":"https://api.github.com/users/tserong/received_events","type":"User","site_admin":false},"created_at":"2015-05-08T04:38:25Z","updated_at":"2015-05-08T04:38:25Z","body":"This might fix it:\r\n\r\n```\r\ndiff --git a/src/json_spirit/json_spirit_reader_template.h b/src/json_spirit/json_spirit_reader_template.h\r\nindex 2eaf743..c50f885 100644\r\n--- a/src/json_spirit/json_spirit_reader_template.h\r\n+++ b/src/json_spirit/json_spirit_reader_template.h\r\n@@ -79,7 +79,7 @@ namespace json_spirit\r\n     template<>\r\n     std::string unicode_str_to_utf8( std::string::const_iterator & begin )\r\n     {\r\n-        typedef typename std::string::value_type Char_type;\r\n+        typedef std::string::value_type Char_type;^M\r\n \r\n         const Char_type c1( *( ++begin ) );\r\n         const Char_type c2( *( ++begin ) );\r\n````\r\n\r\nAlthough I can't say for sure, as I never had that error (\"using 'typename' outside of template\") in my test builds."}}