For use in a questionnaire application, a web service will provide a list of questions in one of several languages, chosen by the user at runtime. The questions will be downloaded from the web service in the chosen language and displayed to the user.
The problem: I have no idea how to do this.
As a sample, I tried loading in UTF-8 text files (e.g. arabic.txt) in the resources containing samples of text in said languages. The files open and render properly in TextMate and TextEdit, but are illegible in Xcode. They are successfully read in, but their contents will not display.
Example:
I create a UITextView
and, at initialization:
...
NSString *path = [[NSBundle mainBundle] pathForResource:@"arabic" ofType:@"txt"];
NSString *arabicString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringENcoding error:&error];
myTextView.text = arabicString;
...
The NSError
returns NULL
, so there's no error reading in the text file, but the contents of the UITextView
is not set. Nothing happens. No error (compilation or runtime), nothing.
Any ideas for a different approach? Or a way to make this work?
Thanks so much.