文件编码库 C++的

文件编码库

 

C++的

https://github.com/BYVoid/uchardet

 

iOS

https://github.com/siuying/UniversalDetector

NSData *data = [NSData dataWithContentsOfFile:self.fileInfo.path];
//获取文件编码
CFStringEncoding encoding = [UniversalDetector encodingWithData:data];
//读取数据
NSString *str = [NSString stringWithContentsOfFile:self.fileInfo.path encoding:CFStringConvertEncodingToNSStringEncoding(encoding) error:&error];

 

你可能感兴趣的:(ios,C++)