有类似的线程,但没有找到答案。当从txt(西里尔文)读取时,我得到\ U00d0 \ U009d \ U00d0或ÐμбÐμ(win1251或UTF8)。任何解决方案? (第一个节目)。谢谢。
NSString *bundlePathName = [[NSBundle mainBundle] resourcePath];
NSString *filePathName = [NSString stringWithFormat:@"%@/text.txt", bundlePathName];
NSError *fileError;
NSString *Content=[NSString stringWithContentsOfFile:filePathName encoding:NSASCIIStringEncoding error:&fileError];
给出\ U00d0 \ U009d \ U00d0,下一个产生ÐμбÐμ
const char *smth=[textContent cStringUsingEncoding:NSUTF8StringEncoding];
NSString *proba= [NSString stringWithCString:smth encoding:NSUTF8StringEncoding];