Using RSS feeds from UTF8 and ISO sites ? Do you build / work with websites written in various languages ? Have you ever work with diacritical symbols (é ê ç è ù ï î û …) ? Then you know the issues we are talking about.
Most wordpress plugins for RSS do not give you the option to activate UTF / ISO filtering of feeds. The solution is to install KB Advanced RSS for widgets that pull RSS Feeds.
However if you wish to create a page or post in WordPress with an integrated feed, you will need to install FirstRSS Plugin for WordPress – But before you upload, you must duplicate / rename the plugin folder and rewrite the code to have the choice between two versions of FirstRSS plugins : one for ISO feeds, one for UTF.
But how do you force UTF coding to an ISO feed on an UTF WordPress site ? Simple, use the function utf8_encode(); where it matters !
If rewriting FirstRSS, make the following changes :
ORIGINAL FirstRSS Code
$disp .= “\t<big><a href=’$link’>$title</a></big><br />\n”;
if ($copy != ”) $disp .= “\t<small>$copy</small><br />\n”;
if ($desc != ”) $disp .= “\t$desc<br />\n”;
$disp .= “\n\t<br />\n”;// For each item…
foreach($rss->items as $item) {
$title = $item[title];
$link = htmlentities($item[link]);
$desc = $item[description];if ($title != ”) $disp .= “\t<b><a href=’$link’>$title</a></b>\n<br />”;
if ($desc != ”) $disp .= “\t$desc\n<br />”;
}
Modified code
$disp .= utf8_encode(“\t<big><a href=’$link’>$title</a></big><br />\n”);
if ($copy != ”) $disp .= “\t<small>$copy</small><br />\n”;
if ($desc != ”) $disp .= utf8_encode(“\t$desc<br />\n”);
$disp .= “\n\t<br />\n”;// For each item…
foreach($utf_rss->items as $item) {
$title = $item[title];
$link = htmlentities($item[link]);
$desc = $item[description];if ($title != ”) $disp .= utf8_encode(“\t<b><a href=’$link’>$title</a></b>\n<br />”);
if ($desc != ”) $disp .= utf8_encode(“\t$desc\n<br />”);
}
Don’t forget to rename the function as two identical functions will cause an error. We chose to rename the function $rss to $utf_rss
What We Tell The World
- About this server
- The hostname: websiteforensics.com
- This server address: 209.237.150.20
What You Tell The World
- Your IP address: 38.107.179.240
- Your hostname: 38.107.179.240
- Your country domain: .240
- You came from:
- Requested URL: /wordpress/uft-iso/
- Browser INFO: CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
February 2nd, 2009 at 3:54 am
Using Feedburner can often solve this issue as well.