json - Using JsonCpp and Qt Together (Problems with Unicode) -


i trying write c++ qt 4.7 app gets json web api. have done reading , jsoncpp seems best. built find , added project fine.

void retrievinginformationpage::replyfinished(qnetworkreply *reply) {      json::value root;     json::reader reader;      bool success = reader.parse(reply->readall().data(), root);      // here issues     qdebug() << qstring::fromstdstring(root["data"][30]["name"].tostyledstring());      return; } 

when run code, outputs name testing (it name unicode in it) special characters output complete gibberish ("à¤?à¥à¤²à¤¿à¤«à¤°à¥à¤¡"). unicode went in json string "\u0915\u094d\u0932\u093f\u092b\u0930\u094d\u0921", assume jsoncpp converts actual unicode characters. hoping qstring::fromstdstring take unicode in std::string , store in qstring, messing somewhere.

what missing?

as far can tell short @ jsoncpp documentation, library delivers strings in utf-8 encoding. convert qstrings use qstring::fromutf8 qdebug use qprintable

qstring::fromstdstring uses qstring::fromascii, see documentation here


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -