views:

284

answers:

1

Hi, Im working on simle RSS reader. This reader loads data from internet via this code:

NSXMLParser *rss = [[NSXMLParser alloc] initWithURL:[NSURL URLWithString:@"http://twitter.com/statuses/user_timeline/50405236.rss"]];

My problem is with encoding. RSS 2.0 file is supposed to be UTF8 encoded according to encoding attribute in XML file.

<?xml version="1.0" encoding="utf-8"?>

So when I download URLs content I get text truncated after first occurance of char with diacritics, example: ľ š č ť ž ý á í é, etc.

I tried to solve the problem by downloading URL as UTF8 string, I used this code:

NSString *rssXmlString = [NSString stringWithContentsOfURL: [NSURL URLWithString: @"http://www.macblog.sk/rss.xml"] encoding:NSUTF8StringEncoding error: nil]; 
NSData *rssXmlData = [rssXmlString dataUsingEncoding: NSUTF8StringEncoding];

Did not help. Thanx for your responses.

A: 

Check out MWFeedParser on GitHub, it's an open source RSS/Atom feed parser I've released and it makes reading and parsing web feeds extremely easy.

There's a simple demo app too which shows how easy it is to implement.

Hope this might be of some use!

Michael Waterfall
Hi Michael thanks for good tip. But now im using Three20 framework and there is build in parser..
Tankista