开发者

how to convert a utf8 format nsstring to a regular nsstring?

i have a question that i get a NSString(maybe i called it astring) form a stream server when i print this astring ,shows\u5f20\u9510\u7b49\u540c\u5fd7\u4efb in console.

It's a NSString(astring) that can be printed to\u5f20\u9510\u7b49\u540c\u5fd7\u4efb by console , and is not such like a NSString* bstring=@"\u5f20\u9510\u7b49\u540c\u5fd7\u4efb"

now, i want to convert this astring to a nsstring which may contains simple chinese character. how coul开发者_JAVA技巧d i do this? Thanks very much! for more detail, the astring is\\u5f20\\u9510\\u7b49\\u540c\\u5fd7\\u4efb in memory


NSString *aString = [NSString stringWithUTF8String:"\u5f20\u9510\u7b49\u540c\u5fd7\u4efb"];
NSLog(@"%@", aString);

This should work right?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜