我需要解析一個帶有法語口音(如'é')的XML feed。 當我分析我失去了口音的XML ...XML解析文本編碼問題
什麼是錯在我的代碼...
NSString *url = [NSString stringWithFormat:@"%@",@"my_xml_url"];
NSURL *myURL = [NSURL URLWithString:url];
NSString *myData = [[NSString alloc] initWithContentsOfURL:myURL];
XMLParser *parser = [[XMLParser alloc] init];
[parser parseXMLFile:myData];
當我開始解析.....
- (void)parseXMLFile:(NSString *)data {
BOOL success;
//array for the ranking
rows = [[NSMutableArray alloc] init];
index = 0;
self.currentString = [NSMutableString string];
storingCharacters = NO;
NSXMLParser *parser = [[NSXMLParser alloc] initWithData:[data data UsingEncoding:NSUTF8StringEncoding]];
[parser setDelegate:self];
[parser setShouldResolveExternalEntities:YES];
success = [parser parse];
self.currentString = nil;
//release memory
[parser release];
}
我看不出是哪裏的問題......
感謝
NSXMLParser是基於事件的。你能告訴我們你在哪裏看着琴絃嗎?這將是一種稱爲像parserFoundCharacters:或parserFoundCDATA: – Walter 2011-05-24 18:38:27
IN - (void)parseXMLFile:(NSString *)數據當我做NSLog(@「%@」,data);我看不到口音......在此之前... – Maxime 2011-05-24 18:42:16