This code shows correctly as Ecole
with an accent on E
:
NSString *test = @"\u00c9cole";
cell.detailTextLabel.text = test;
But when I get the string from my server sent as Json, I don't see E
with an accent but rather the unicode \u00c9
.
Code for getting Json string from server:
- (void) handleProfileDidDownload: (ASIHTTPRequest*) theRequest
{
NSMutableString *str = [[NSMutableString alloc] init];
[str setString:[theRequest responseString]];
[self preprocess:str]; //NSLog here shows str has the unicode characters \u00c9
}
- (void) preprocess: (NSMutableString*) str
{
[str replaceOccurrencesOfString:@"\n" withString:@"" options:NSLiteralSearch range:NSMakeRange(0, [str length])];
[str replaceOccurrencesOfString:@"\"" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [str length])];
[str replaceOccurrencesOfString:@"\\/" withString:@"/" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [str length])];
}
Now if I do,
cell.detailTextLabel.text = str;
I don't get the accent for E rather \u00c9
What am I doing wrong?