doc file created in iPhone documents encoding issue

Posted by Saurabh Verma on Stack Overflow See other posts from Stack Overflow or by Saurabh Verma
Published on 2010-06-11T07:51:27Z Indexed on 2010/06/11 8:12 UTC
Read the original article Hit count: 228

Filed under:

I'm trying to write a MSword file in document directory by the following code:

NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
NSString* path;
NSString* gradeDoc = [self fetchCommentsDesc];
NSString* str = [self.objStudent.strName stringByAppendingFormat:@".doc"];
path = [[paths objectAtIndex:0] stringByAppendingPathComponent:str];
[gradeDoc writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:nil];

[self fetchCommentsDesc] returns NSString.
self.student.strName is a String

Issue: When i Open the doc file created in document directory of iphone, all the special characters in the doc appears as boxes or some arabic chars.

Please help!

© Stack Overflow or respective owner

Related posts about iphone