文件编码库
?
C++的
https://github.com/BYVoid/uchardet
?
https://github.com/siuying/UniversalDetector
class="c">NSData *data = [NSData dataWithContentsOfFile:self.fileInfo.path]; //获取文件编码 CFStringEncoding encoding = [UniversalDetector encodingWithData:data]; //读取数据 NSString *str = [NSString stringWithContentsOfFile:self.fileInfo.path encoding:CFStringConvertEncodingToNSStringEncoding(encoding) error:&error];
?