problem with unknown characters in rss feed
Posted: Thu Jun 09, 2011 3:58 pm
i'm having a problem with unknown characters showing up in my rss feed. the problem appears to be the quote symbol ("), as well as a black diamond with a ? inside it. for instance, one title might show up like this:
?Cure for the Common Font? ? A Web Designer?s Introduction to Typeface�Selection (this is the way it is displaying)
Cure for the Common Font? A Web Designer's Introduction to Typeface Selection (this is how it should display)
for some reason, the (") symbol is showing up as a (?). i can use the str_replace function to replace the (?) with a ("), however, if there is a legit (?) in the title, as in the example above, it also gets changed to a ("). as far as the black diamond goes, i have no clue what is doing that so i don't know where to begin trying to replace it.
my code is currently as follows:
Can someone please give me an idea as to how to correct this problem? also, charset is set to UTF-8.
?Cure for the Common Font? ? A Web Designer?s Introduction to Typeface�Selection (this is the way it is displaying)
Cure for the Common Font? A Web Designer's Introduction to Typeface Selection (this is how it should display)
for some reason, the (") symbol is showing up as a (?). i can use the str_replace function to replace the (?) with a ("), however, if there is a legit (?) in the title, as in the example above, it also gets changed to a ("). as far as the black diamond goes, i have no clue what is doing that so i don't know where to begin trying to replace it.
my code is currently as follows:
Code: Select all
<?php
$search = array("?","\n", "\r\n", "
", "	", "%09", "%20", "\0");
$replace = array('"',"", "", "", " ", ",", " ", "");
?>
<?php do { ?>
<div class="resourcesFeedCntr">
<div class="resourcesFeedTitle"><a href="<?php echo $row_resourceFeed_rs['resource_link']; ?>"><?php echo $row_resourceFeed_rs['resource_title']; ?></a></div>
<div class="resourcesFeedContent">
<?php include('RSS/rss_fetch.inc');
$rss = fetch_rss($row_resourceFeed_rs['resource_rssLink']);
// Split the array to show first 8 listings
$items = array_slice($rss->items, 0, 8);
// Cycle through and display the listings
foreach ($items as $item )
{ ?>
<li><a href="<?php echo $item['link']; ?>"><?php echo str_replace($search,$replace,$item['title']); ?></a></li>
<?php } while ($row_resourceFeed_rs = mysql_fetch_assoc($resourceFeed_rs)); ?>