views:

284

answers:

1

i have tried to remove umlaults from XML.i have also used some code like this but still it's not working so please help me in my task.

NSString *something  = [self base64StringFromData:CDATABlock length:[CDATABlock  length]];   
NSData *pageData=[something dataUsingEncoding:NSUTF8StringEncoding];
NSString *webpage = [NSString stringWithCString:something encoding:NSUTF8StringEncoding];
NSString *torrent = [NSString stringWithUTF8String:something];
NSString *body = [NSString stringWithCString:[CDATABlock bytes] length:[CDATABlock length] encoding:NSUTF8StringEncoding];
NSData *torrent = [ objectFromEncodedData:CDATABlock];
NSString *secondtry = [NSString stringWithFormat:@"%.*s", [CDATABlock length], [CDATABlock bytes]];
NSString *secondtry = [[NSString alloc] initWithBytes:[CDATABlock bytes]length:[CDATABlock length] encoding: NSUTF8StringEncoding];
NSString *secondtry = [NSString stringWithCString:[CDATABlock bytes] encoding:NSUTF8StringEncoding];
NSString *secondtry = [NSString stringWithUTF8String:[CDATABlock bytes]];
NSString *secondtry = [NSString stringWithCharacters:[CDATABlock bytes] length:[CDATABlock length] / sizeof(unichar)];

Actually from XML i got this tag

[CDATA[Dickensstraße, Zoo, Mitte (Stadtbezirk), Hannover, Region Hannover, 30175, Niedersachsen, Deutschland]]

and it Display this tag so why i got wrong string in Display.

DickensstraÃe, Zoo, Mitte (Stadtbezirk), Hannover, Region Hannover, 30175, Niedersachsen, Deutschland
A: 

You have to figure out what encoding was used to put the text in the CDATA block in the first place, and use that same encoding on the data you get out.

Although I have to say, if there's any way NOT to wrap the text in a CDATA block I would do that. It's a horrible abuse of XML which handles unicode quite well...

Kendall Helmstetter Gelner