NSMutableString and (character)-encoding issue: getting \U00fc in case of ü

i am fetching my entity from coreData and saving the result of fetchrequest to an NSMutableString for text to speech.

self.ttsInboxCards = [[NSMutableString alloc] initWithString:@""];  
[self.ttsInboxCards appendString:[[entitySetsCards valueForKey:@"cardTitle"] description]];

And in NSLog i am getting this values:

F\U00fcr | schl\U00e4ge | zuh\U00f6ren  

which should be:

Für | schläge | zuhören  

I have tried a lot of things to get the correct encoding, for example with:

stringWithUTF8String:  

and so on, but nothing worked.

How can i prevent this issue?

EDIT 1:

I am getting the values from coreData like this: NSFetchRequest *fetchRequest = [[[NSFetchRequest alloc] init] autorelease];

NSEntityDescription *entity = [NSEntityDescription entityForName:@"EntitySetsCardsInbox" inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];

NSPredicate *inboxPred = [NSPredicate predicateWithFormat:@"archived == 0 AND cardId != 0"];


[fetchRequest setPredicate:inboxPred];

NSSortDescriptor *sortDescriptor2 = [[[NSSortDescriptor alloc] initWithKey:sortString ascending:sortAsc selector:@selector(localizedCaseInsensitiveCompare:)] autorelease];
NSArray *sortDescriptors = [[[NSArray alloc] initWithObjects:sortDescriptor2, nil] autorelease];
[fetchRequest setSortDescriptors:sortDescriptors];

NSError *error = nil;
NSArray *cardTitles = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];



[self.ttsInboxCards appendString:[[cardTitles valueForKey:@"cardTitle"] description]];

TextToSpeech

    if (isSpeaking) {
    [vocalizer cancel];
    isSpeaking = NO;
}
else {
    isSpeaking = YES;
    vocalizer = [[SKVocalizer alloc] initWithLanguage:@"de_DE" delegate:self];
    [vocalizer speakString:tmp];


}

Answers


I wrote:

cardTitles is an array. So, invoking -valueForKey: on it yields an array built by invoking -valueForKey:@"cardTitle" on each element. Then you're asking that array for its description. It's very likely to do formatting of its contents.

brush51 wrote:

componentsJoinedByString: worked and solved the issue with encoding. now i have to split them correctly so that i can use it cleanly for text to speech. can you make an answer with that so i can mark this question as answered and others can find it faster


Need Your Help