Objective c 触摸JSON解码问题

Objective c 触摸JSON解码问题,objective-c,json,utf-8,decoding,deserialization,Objective C,Json,Utf 8,Decoding,Deserialization,我正在尝试将JSON解码为包含许多字符串对的NSDictionary。一些返回的字符串返回为&而不是&,并且一些非英语字符显示为其url编码值,而不是正确解码的值。我怎样才能解决这个问题 NSString *strContent = [[NSString alloc] initWithBytes:[responseData bytes] length:[responseData length] encoding: NSUTF8StringEncoding]; //I cache the

我正在尝试将JSON解码为包含许多字符串对的NSDictionary。一些返回的字符串返回为
&
而不是
&
,并且一些非英语字符显示为其url编码值,而不是正确解码的值。我怎样才能解决这个问题

NSString *strContent = [[NSString alloc] initWithBytes:[responseData bytes] length:[responseData length] encoding: NSUTF8StringEncoding];

//I cache the string here

NSData *jsonData = [strContent dataUsingEncoding:NSUTF8StringEncoding];
NSError *error = nil;
NSDictionary *dictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];

它是到达时的有效载荷。您必须在创建字典后处理此问题。当您需要处理数据或提前遍历字典并将数据转换为所需格式时,您可以及时执行此操作

以下NSString方法可以方便地避开url编码: StringByReplacing百分比转义使用编码

要查看unescape html实体,它提供了一种干净的方法