数组 和字典打印出来的汉字 一直是UTF8编码, 看数据不方便
只需要给 NSArray 和NSDictionary 添加两个分类 就能解决了此问题
#import "NSArray+decription.h"
@implementation NSArray (decription)
- (NSString *)descriptionWithLocale:(id)locale
{
NSMutableString *str = [NSMutableString stringWithFormat:@"%lu (\n", (unsigned long)self.count];
for (id obj in self) {
[str appendFormat:@"\t%@, \n", obj];
}
[str appendString:@")"];
return str;
}
@end
#import "NSDictionary+decription.h"
@implementation NSDictionary (decription)
- (NSString *)descriptionWithLocale:(id)locale
{
NSArray *allKeys = [self allKeys];
NSMutableString *str = [[NSMutableString alloc] initWithFormat:@"{\t\n "];
for (NSString *key in allKeys) {
id value= self[key];
[str appendFormat:@"\t \"%@\" = %@,\n",key, value];
}
[str appendString:@"}"];
return str;
}
@end