Thanks for this answer and sorry for my premature posts: S I hope this at least helps anyone who has the same problem as mine. I just chatted with a friend and he told me:
To display and ampersand in XML just use & quotes. Unlike pure "&", NSXMLParser does not throw an error. Using & also allows you to do other escape sequences of characters, for example:
- & uuml; [in text] → & uuml; [in HTML] → & uuml; [in XML]
- & Auml; [in text] → & Auml; [in HTML] → & Auml; [in XML]
- & szlig; [in text] → & szlig; [in HTML] → & szlig; [in XML]
- etc.
So, how do you decide "How to parse XML with an amplifier in it." I also managed to make a code, from the site that I linked in the comments to my original question, the work:
NSMutableString *deutschEscaped = [NSMutableString stringWithString:[[deutschTextLabel string] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; [deutschEscaped replaceOccurrencesOfString:@"$" withString:@"%24" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@"&" withString:@"%26" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@"+" withString:@"%2B" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@"," withString:@"%2C" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@"/" withString:@"%2F" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@":" withString:@"%3A" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@";" withString:@"%3B" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@"=" withString:@"%3D" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@"?" withString:@"%3F" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@"@" withString:@"%40" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@" " withString:@"%20" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@"\t" withString:@"%09" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@"#" withString:@"%23" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@"<" withString:@"%3C" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@">" withString:@"%3E" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@"\"" withString:@"%22" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])]; [deutschEscaped replaceOccurrencesOfString:@"\n" withString:@"%0A" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [deutschEscaped length])];
This works great for me and replaces ampersands and any other possible dangers.
If you do not want to have only 20 screens for each space, you can also use:
NSMutableString *englishEscaped = [NSMutableString stringWithString:[[englishTextLabel string] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
Thanks everyone :)
source share