NSXMLParser problem with “&”(Ampersand) character

后端 未结 3 1818
误落风尘
误落风尘 2021-01-16 09:14

My NSXMLParsing is not working because of \"&\" character.. my code s below .any help please ?

 NSString *myRequestString = [NSString stringWithFormat:@         


        
3条回答
  •  囚心锁ツ
    2021-01-16 09:44

    Replace

    NSString *str = [[NSString alloc] initWithData:downloadedData encoding:NSASCIIStringEncoding];
    //NSString *contentString = [str stringByReplacingOccurrencesOfString:@"&" withString:@"&"];
    NSData * data=[str dataUsingEncoding:NSUTF8StringEncoding];
    

    With:

    NSString *str = [[NSString alloc] initWithData:downloadedData encoding:NSASCIIStringEncoding];
    NSString *contentString = [str stringByReplacingOccurrencesOfString:@"&" withString:@"&"];
    NSData * data=[contentString dataUsingEncoding:NSUTF8StringEncoding];
    

提交回复
热议问题