Re: Trouble getting ISO-8859-1 encoded feed to parse and display
Re: Trouble getting ISO-8859-1 encoded feed to parse and display
- Subject: Re: Trouble getting ISO-8859-1 encoded feed to parse and display
- From: Jens Alfke <email@hidden>
- Date: Sun, 23 Nov 2014 20:15:37 -0800
> On Nov 23, 2014, at 1:06 PM, Diederik Meijer | Ten Horses <email@hidden> wrote:
>
> When I just pull in the feed’s contents using a NSURLConnection, it will show up on some, but not all, devices.
What does "show up" mean in this case? Is there an error? If so, what is it?
> When I try to log the response data, by creating a string that I init with the downloaded data and NSUTF8StringEncoding, the log will show a null string. So putting the downloaded data into a string using UTF8 doesn’t work.
UTF-8 is a completely different encoding.
> I validated the feed’s XML and got no errors..
It's valid XML, but it's got some problems as an RSS feed; take a look at
http://feedvalidator.org/check.cgi?url=https://www.taxpublications.deloitte.co.uk/tis/dtp.nsf/pub1.xml <http://feedvalidator.org/check.cgi?url=https://www.taxpublications.deloitte.co.uk/tis/dtp.nsf/pub1.xml>
These are mostly minor, like nonstandard extra elements, but it's also got problems with its date formatting, and also the server reports the Content-Type is ASCII while the XML says it's ISO-8859-1.
If NSXMLParser is having trouble with the encoding, one problem I've seen before is documents that claim to be ISO-8859-1 while actually being WinLatin, which is a superset with extra characters defined. (The Cocoa encoding name for this is NSWindowsCP1252StringEncoding, IIRC.)
(I spent four years of my life immersed in RSS feed parsing, and acquired a solid contempt for the ability of the average web developer to construct a valid feed. You would not believe how many messed-up feeds there are in the real world.)
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden