NSString *path =[[NSBundle mainBundle]pathForResource:@"1025626909" ofType:@"txt"];
NSStringEncoding enc;
NSError *error;
NSString *pageSource = [[NSString alloc] initWithContentsOfFile:path usedEncoding:&enc error:&error];
NSLog(@"==%@",pageSource);
NSLog(@"==%@",[error description]);
above code output this:</p>
2013-09-16 17:40:08.843 encodingTest[3350:c07] ==(null)
2013-09-16 17:40:08.846 encodingTest[3350:c07] ==Error Domain=NSCocoaErrorDomain Code=264 "The operation couldn’t be completed. (Cocoa error 264.)" UserInfo=0x71a5af0 {NSFilePath=/Users/dayu/Library/Application Support/iPhone Simulator/6.1/Applications/A33DE8D6-D64B-4791-ADB6-1AB4B35B743A/encodingTest.app/1025626909.txt
I can't get the txt file's content,hope superman come help me 。。。。。</p>
I find the file I found this file encoding is GB2312 by other means,then i used the kCFStringEncodingGB_2312_80 code . There is no effect 。。。</p>