ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Magpie Crashing

December 08, 2011 6:53am

Subscribe [2]
  • #1 / Dec 08, 2011 6:53am

    Narthex

    83 posts

    I’m pulling the “Astronomy Picture of the Day” feed from http://apod.nasa.gov/apod.rss

    According to feedvalidator.org magpie can’t handle an apostrophe in the feed that has the wrong encoding.  That single character is blowing the whole feed, creating a hole in my site where that feed usually goes.  The error references an invalid character

    First of all, I’m amazed magpie can’t deal with a single weird character.  Can’t it ignore it, or put in a question mark, or asterisk instead?  I’m only pulling the one latest post, but since the post with the weird character is still in their stack magpie still refuses to parse anything. 

    Secondly, is there anything I can do about this? 

    I tried putting in

    {exp:magpie url="http://apod.nasa.gov/apod.rss" limit="1" refresh="1" parse="inward" convert_encoding="y" encode="UTF-8"}

    but that doesn’t seem to help…

    I have contacted the feed admins, but I’m not sure they’ll do anything to fix the feed or encode the feed correctly…

    I found this page:  http://simplestation.com/locomotion/displaying-html-entities-in-magpie-rss/, that suggests a potential solution, but I do not know php encoding.

    Please help!

  • #2 / Dec 08, 2011 7:26am

    Narthex

    83 posts

    Here’s another page with php suggestions that seem to help…  http://www.mybelovedphp.com/2009/07/03/fix-broken-utf8-encoded-rss-feeds-in-php/

  • #3 / Dec 08, 2011 4:53pm

    Kevin Smith

    4784 posts

    Hey Nerthex,

    Sorry to see you’re running into this. To be sure, Magpie is an RSS parser, and its abilities are out of our control. We wrap a plugin around it to help bring RSS feeds into EE, but we’re actually not involved in the development of Magpie itself.

    I’m not sure if there’s anything that can be done to alleviate the woes caused by a badly formatted feed, but I suspect you might find some relief in a solution you posted here a few years back. 😉

  • #4 / Dec 09, 2011 9:44am

    Narthex

    83 posts

    Thanks, but it used to be that you could post your challenges and others would post their solutions, even if the problem wasn’t EE per se.  Is this posted in the wrong forum?

    The page that pulls the feed is encoded for utf-8 just fine.  But the feed is not validating because of a curly apostrophe.  I either need the feed to change its encoding (trying) or I need magpie to be adjusted to deal with these errors…

    Can anyone help?

  • #5 / Dec 09, 2011 11:08am

    Narthex

    83 posts

    FIXED. (Sort of.)

    Here’s the workaround.  Copy the http address of the rss feed.  Open Firefox.  Paste the rss feed address into the FF browser window, but append view-source: to the http, like so— view-source:http://apod.nasa.gov/apod.rss   .  This gives you the exact text of the rss feed.  Copy the entire thing.

    Now create a new template in EE.  Make it an rss template.  Paste in the code from the rss feed. If necessary add the following as the first line of the feed—  <?xml version=“1.0” encoding=“utf-8”?>  Now go through and fix the curly quotes or curly apostrophes.  Delete them and retype the character. Save the template.

    Now go into your EE code and replace the normal external rss feed address with your new rss page’s address.

    WHAT THIS ACCOMPLISHES:  Now you have a non-updating rss feed that validates that uses all the info and links from the original one.  You no longer have a hole in your page, and your users can enjoy the content.

    WHAT THIS DOESN’T ACCOMPLISH:  Obviously this rss feed will not update itself.  It will stay the same forever.  Day by day you will have to re-do the above steps until the rss post with the non-validating characters expires, replaced by newer articles.

    True, this is a pain, but for my use I’d rather take the 5 minutes a day to do the above and have 7 days of a working feed in my page than wait 7 days with nothing there until the feed begins working again.

    PLEASE, if someone has an actual php or other fix for non-validating feeds due to magpie not handling curly quotes or curly apostrophes, please share it!

    All the Best,
      Narthex

  • #6 / Dec 12, 2011 3:34pm

    Kevin Smith

    4784 posts

    it used to be that you could post your challenges and others would post their solutions, even if the problem wasn’t EE per se.  Is this posted in the wrong forum?

    Oh, that sort of thing is always welcome in the Community Help forum. This is an official tech support forum, only for issues that are immediately related to ExpressionEngine and our first-party plugins. I’d love to move this thread over to Community Help for you if you’d like. Others in the community might have a good suggestion for you there.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases