Jump to content

Recommended Posts

I'm in the process of displaying an rss feed from one of my sites to another. I downloaded a nice, simple php script to display the feed, and it works great. With one exception. I get this:

 

“Screaming Parrots†The Wendy’s...

 

instead of this:

 

"Screaming Parrots" The Wendy's

 

The RSS displays find in a normal reader, so I'm confident it's not happening on the RSS end of things. I think it's something with the script I'm using that it isn't properly handling the quotes and apostrophes. I've played around with various functions to try to take care of it, but nothing is working. Here is the part of the script I'm using (again, I didn't write this, but I can't find any way to contact the guy who did):

$RSS_Content = array();

function RSS_Tags($item, $type)
{
	$y = array();
	$tnl = $item->getElementsByTagName("title");
	$tnl = $tnl->item(0);
	$title = $tnl->firstChild->data;

	$tnl = $item->getElementsByTagName("link");
	$tnl = $tnl->item(0);
	$link = $tnl->firstChild->data;

	$tnl = $item->getElementsByTagName("description");
	$tnl = $tnl->item(0);
	$description = $tnl->firstChild->data;

	$y["title"] = $title;
	$y["link"] = $link;
	$y["description"] = $description;
	$y["type"] = $type;

	return $y;
}

function RSS_Links($url, $size)
{
global $RSS_Content;

$page = "<ul>";

RSS_RetrieveLinks($url);
if($size > 0)
	$recents = array_slice($RSS_Content, 0, $size);

foreach($recents as $article)
{
	$type = $article["type"];
	if($type == 0) continue;
	$title = $article["title"];
	$link = $article["link"];
	$page .= "<li><a href=\"$link\">$title</a></li>\n";			
}

$page .="</ul>\n";

return $page;

}

 

Any suggestions are greatly appreciated. Thanks.

 

That typically happens when the original quote or apostrophe was copied out of Microsoft Word, and they are not actual quotes or apostrophe's, but rather Microsoft symbols that look similar.  This method is used so the quotes and apostrophes resemble the corresponding font in Microsoft applications, however it is also the reason all text should be copied into a text editor (to convert the Microsoft symbols) before being entered into the database.

As a possible solution ...

 

Copy the quote character as it appears in the feed ... then in your display script do a str_replace('funnyQuote', '"', $rssFeed) and see if it will hit on the special quote character and replace it with an actual quote character.

Copy the quote character as it appears in the feed ... then in your display script do a str_replace('funnyQuote', '"', $rssFeed) and see if it will hit on the special quote character and replace it with an actual quote character.

 

Dang, didn't work. I really thought it would, too.

 

I also, to make sure, created a new article (the originating site is a WordPress site) to test, and the quotes and apostrophes were messed up in that one, too. So it's definitely not a copy/paste issue from Word (which is what I originally thought it would be).

Do you have a url we can look at?

 

Sure. The originating site is www.adoptidaho.org. Here's a test page of the feed I'm trying to post:

 

http://www.idahowednesdayschild.org/testrss.php

 

The script is in my first post (the one that parses the rss file for use on the other site).

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.