Feb
06
2009

Character Issues with the Magpie RSS Parser

by   |  Posted in Tutorials  |  6 comments

A client asked for me to put together a page on his website that would collect info off of his RSS feed and populate a page that could be viewable by a handheld device. I decided to use a great tool called Magpie RSS to do the job but I encountered an issue with it not displaying certain characters properly.

When I first used Magpie RSS to parse the feed, some code came back displaying like this:

first

Instead of like this:

second

The solution was simple. Before you first call the Magpie RSS parser with PHP using the following code:

require_once 'rss_fetch.inc';

you need to add:

define('MAGPIE_INPUT_ENCODING', 'UTF-8');
define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');

That will display every foreign character the way it should be displayed.

About the author:

A freelance web developer living in Montreal who spends most of his time writing for this site and building Premium themes for WordPress. You can find him on Twitter @bavotasan.

Site5 Affiliate Link
If you liked this, please share it.

Tags: , , , , , , , , , , , ,

Short URL: http://bit.ly/auSAnf

Discussion 6 Comments

  1. Kathy on March 20, 2009 at 10:54 am

    This was really helpful, thanks!

  2. Dan on August 7, 2009 at 5:00 am

    I was having trouble with this, thanks!

  3. desis on January 18, 2010 at 6:34 pm

    Hope that would solve my problem.. Once I heard magpie does not have the ability to parse unicode … that was quite wrong.. good to know that.

  4. Wyatt Richardson on May 20, 2010 at 1:24 pm

    RSS Feeds are really very helpful and you could get site and news updates from it.-”~

  5. Sophie Sanders on July 28, 2010 at 4:17 am

    RSS feeds are really great because you are always updated with the latest news or blog posts.-’,

  6. Will on March 16, 2011 at 2:50 pm

    Works like a charm! I was trying to use PHP to format the output but didn’t realize that the problem was coming from Magpie itself. Thanks!