0

There are similar threads, but didn't find answer.When read from txt (cyrillic) I got either \U00d0\U009d\U00d0 or ебе (win1251 or UTF8). Any solution to that? (first program).Thank you.

     NSString *bundlePathName = [[NSBundle mainBundle] resourcePath];
     NSString *filePathName = [NSString stringWithFormat:@"%@/text.txt", bundlePathName];
     NSError *fileError;
     NSString *Content=[NSString stringWithContentsOfFile:filePathName  encoding:NSASCIIStringEncoding error:&fileError];

gives \U00d0\U009d\U00d0, next one produces ебе

     const char *smth=[textContent cStringUsingEncoding:NSUTF8StringEncoding];
      NSString *proba= [NSString stringWithCString:smth encoding:NSUTF8StringEncoding];  
Wyetro
  • 8,439
  • 9
  • 46
  • 64
IchBin
  • 19
  • 3
  • What encoding is the text file encoded in? What data are you expecting to get back? – Adam Rosenfield Aug 07 '14 at 04:27
  • tried 2 -first win1251 (old file), then made it in UTF8. Expect to get strings of text from array (1 case) with filtered array using predicate, second case- just tried to see if it's going to show cyrillic (text as NSString). – IchBin Aug 07 '14 at 04:54
  • I guess there is smth with encoding from format to format, when used other file made from beginning with UTF8 - no problem. – IchBin Aug 08 '14 at 11:36

0 Answers0