cocos2d-x c++ string unicode convert -
i request web page using cchttprequest
when print received response ccstring
can see turkish characters without problems when assign received response using std::string
, print in cclog
strange characters come up. how can fix this?
std::vector<char> *buffer = response->getresponsedata(); char jenny [buffer->size()]; (unsigned int = 0; < buffer->size(); i++) { jenny[i] = (*buffer)[i]; } ccstring* ustr = ccstring::createwithcontentsoffile(jenny); string wstr(jenny); cclog("%ls", &wstr);
ccstring response : data file(< ?xml version="1.0" encoding="utf-8"?> < string xmlns="http://tempuri.org/" > gönderildi < / string >
string cclog response : ����k�4p�
do want print values in cclog or want display them in cclabel?
if want display them in cclabel can in following way:
- store values in std::string
- when assigning label use c_str() method retrieve value.
example:
std::string friendid = frienddetails->getfbid(); cclabelttf *friendnamelabel = cclabelttf::create(friendname.c_str(), "helvetica", 20.0 * menu_font_scale); friendnamelabel->setstring(friendname.c_str());
imo, should work fine. using them in 1 of library in getting data facebook , using in game.
here code link displaying names of facebook friends of fb user.
Comments
Post a Comment