OC

Knowledge OS
登录 注册
全部话题 移民 创业 iOS Mac Objective-C Swift Android 招聘 求职

NSJSONSerialization如何encoding?

Systemlord
Systemlord 发布于 2013年08月15日 | 更新于 2013年08月16日
无人欣赏。
// responseData is NSMutableData
NSString *json = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"json: %@", json);

json 的内容可以正常显示汉字。

NSMutableDictionary *result = [NSJSONSerialization JSONObjectWithData:[json dataUsingEncoding:NSUTF8StringEncoding] options:0 error:nil]; 
NSLog(@"result: %@", result);

result 却无法显示汉字。

共3条回复
楼长 ·
tinyfool 回复于 2013年08月15日

看不懂你的意思

2楼 ·
tangyumeng 回复于 2013年08月15日

他的意思是,log输出是 显示 为11="iOS开发"而不是 11 = "iOS\U5f00\U53d1"; ,是这个意思么

3楼 ·
Systemlord 回复于 2013年08月16日

+tangyumeng 是的,NSJSONSerialization好像无法encoding。

登录 或者 注册

AltStyle によって変換されたページ (->オリジナル) /