Sunday 15 July 2012

c++ - converting a weird std::string into an NSString -



c++ - converting a weird std::string into an NSString -

i have weird situation trying convert std::string nsstring.

i have tried usual method works is: [nsstring stringwithutf8string: mycppstring.c_str()];

however, getting nil returned. think has weird characters. because have seen next in info on investigation:

notice upsidedown question marks. tried phone call found when looking through did not work: [nsstring stringwithcstring:mycppstring encoding:nsutf8stringencoding];

i can print string out const char * , std::string saw logs. c++ string made ostringstream if has impact. info comes server should utf-8 , fed through json sqlite database.

do have advice on how can nsstring work?

=== [edit] === came hex info 1 particular reason upside-down question-marks.

it turns out weird characters represented non-existent beingness read in in particular case reading map key , didn't check if find command returned mymap.end().

thank time in reviewing question.

c++ objective-c nsstring stdstring

No comments:

Post a Comment