ITeye博客

Convert UTF-8 encoded NSData to NSString,转载自stackoverflow

eleopard · 2014-07-07 10:39 · IOS · 编程语言 · Markdown

If the data is not null-terminated, you should use -initWithData:encoding: NSString* newStr = initWithData:theData encoding:NSUTF8StringEncoding];

If the data is null-terminated, you should instead use -stringWithUTF8String: to avoid the extra \0 at the end. NSString* newStr = ];

转载地址:http://stackoverflow.com/questions/2467844/convert-utf-8-encoded-nsdata-to-nsstring/2467856#2467856

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。