Problem Description
I have an RSS Feed reader that does the usual GET on a feed using the typical code (straight from the API examples - see below).
I've attached the downloaded XML source of this particular feed - the actual feed URL is not useful since they've deleted the offending item from the feed.
The feed is from a government agency and so I have no control over it although I am trying to advise them on how to properly manage this RSS Feed.
The problem is that there is an "illegal" character in the title of the first item.
(I'm going to use this "illegal" term for lack of a better name for it - its just not a UTF-8 character - and I don't know what the heck it really is).
It is one of those black diamonds with a white question mark - probably caused by someone doing cut-and-paste directly from Word or Outlook.
As a result, on iOS 5 with SDK 1.8.all and probably with 1.7 as well (and I even tried it with a 2.0 build), there is no way to get the text or XML of the feed.
This appears to be similar to other reports about trying to use unsupported character sets.
Actual Results
The GET is successful (200) but both responseText and responseXML were either null or undefined because the implicit conversion to text or XML failed because of the single illegal character.
ResponseData had 9120 bytes but since the .text, .getText() and .toString() and similar conversion routines all apparently share the same code,
there was no way to convert the ResponseData into a text string.
So the RSS Feed appeared to be empty.
Expected results
Getting the XML even if one character is invalid.
Test case
var client = Ti.Network.createHTTPClient({
// function called when the response data is available
onload : function(e) {
// responseText is either null or undefined
Ti.API.info("Received text: " + this.responseText);
// responseXML is either null or undefined
Ti.API.info("Received XML: " + this.responseXML);
alert('success');
},
// function called when an error occurs, including a timeout
onerror : function(e) {
Ti.API.debug(e.error);
alert('error');
},
timeout : 5000 /* in milliseconds */
});
// Prepare the connection.
client.open("GET", url);
// Send the request.
client.send();
Extra info
Extra info
Interestingly, both Firefox and Internet Explorer shared this behavior - they also showed this RSS Feed to be empty when it had 4+ entries.
With Firefox, the browser window showed no entries, but "view source" window showed the entries (and the illegal character) - and that is the file that is attached.
But Safari, Opera, and Android all displayed the RSS Feed and ignored the illegal character.
I could accept this situation IF there was a workaround to convert ResponseData into a text string, but since the only binary-to-text-conversion capability is broken by the illegal character in this situation, I'm completely stuck.
Anyway, I ended up having to get the owner of the feed to delete this item because I was caught in this catch-22.
Apologies in advance for a not well organized post - was up until the wee hours trying to figure out a workaround, searching Q&A, Jira, Google, etc.
Hello, if this is breaking in other places like firefox, what you should do is fixing it in the webserver/feed generator part of the equation. If you have the feed url, we can show this corner case to our Platform engineers. Please add the feed url here in the comments, so we can check on it. Best, Mauro
First, thank you very much for promoting this into TIMOB. Really appreciate it. In terms of fixing the webserver/feed generator which allowed the "illegal character", the RSS feed is from a government agency that is using a feed generator from Cooper Notification that is a COTS product which they have no control over. Fortunately in this case reason prevailed and they removed the offending message. And I've advised them to stop doing cut-and-paste between Word & Outlook and their feed. Only time will tell. The particular feed in question is https://www.smcalert.info/rssfeed.php which is functioning OK right now but if another illegal character situation comes up, I'll post follow-up here. Thanks, Joe
Fixed by TIMOB-9558
Verified on: Titanium Studio: 2.1.2.201208301612 Titanium SDK: 2.2.0.v20120830182512 iOS Simulator v5.1