打印网络请求回来的unicode转中文

#import   
  
@implementation NSDictionary (Log)  
- (NSString *)descriptionWithLocale:(id)locale  
{  
    NSMutableString *string = [NSMutableString string];  
      
    // 开头有个{  
    [string appendString:@"{\n"];  
      
    // 遍历所有的键值对  
    [self enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOLBOOL *stop) {  
        [string appendFormat:@"\t%@", key];  
        [string appendString:@" : "];  
        [string appendFormat:@"%@,\n", obj];  
    }];  
      
    // 结尾有个}  
    [string appendString:@"}"];  
      
    // 查找最后一个逗号  
    NSRange range = [string rangeOfString:@"," options:NSBackwardsSearch];  
    if (range.location != NSNotFound)  
    [string deleteCharactersInRange:range];  
      
    return string;  
}  
@end  
  
@implementation NSArray (Log)  
  
- (NSString *)descriptionWithLocale:(id)locale  
{  
    NSMutableString *string = [NSMutableString string];  
      
    // 开头有个[  
    [string appendString:@"[\n"];  
      
    // 遍历所有的元素  
    [self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOLBOOL *stop) {  
        [string appendFormat:@"\t%@,\n", obj];  
    }];  
      
    // 结尾有个]  
    [string appendString:@"]"];  
      
    // 查找最后一个逗号  
    NSRange range = [string rangeOfString:@"," options:NSBackwardsSearch];  
    if (range.location != NSNotFound)  
    [string deleteCharactersInRange:range];  
      
    return string;  
}  
  
@end  

你可能感兴趣的:(打印网络请求回来的unicode转中文)