There is a txt file is gb18030 coding,
Thus read, get the string null value. data has a value, the path has value.
Estimated coding problem, ask how to solve this.
NSData * data = [NSData dataWithContentsOfFile: [[NSBundle mainBundle] pathForResource: @ "about" ofType: @ "txt"]];
NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding (kCFStringEncodingGB_2312_80);
NSString * strContent = [[NSString alloc] initWithData: data encoding: enc];
Reply:
That change GB18030 encoding try
NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding (kCFStringEncodingGB_18030_2000);
NSString * strContent = [[NSString alloc] initWithData: data encoding: enc];
No comments:
Post a Comment