views:

53

answers:

0

I'm using an NSXMLParser to grab the an XML file on the web like so:

NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
[xmlParser setDelegate:delegate];
[xmlParser parse];
[xmlParser release];

In the delegate I have the following code:

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
{
    if([elementName isEqualToString:@"user"]){
        NSLog(@"I have finished id: %@", [attributeDict valueForKey:@"id"]);
    }
}

In my XML, I have a few hundred user nodes with id attributes. the entries up to id=109 parse perfectly. id=110 has chinese characters in it and the parser seems to bail out, no error message or anything, just thinks the file has ended judging by the fact that this output after ID=109

-(void)parserDidEndDocument:(NSXMLParser *)parser
{
    NSLog(@"All done");
]

How can I get it to parse the Chinese characters?

At the top of the XML file, the prolog includes the UTF-8 encoding.

Thanks