Dimwhit Posted July 14, 2009 Share Posted July 14, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/165932-garbled-quotesapostrophes-in-rss-display/ Share on other sites More sharing options...
p2grace Posted July 14, 2009 Share Posted July 14, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/165932-garbled-quotesapostrophes-in-rss-display/#findComment-875347 Share on other sites More sharing options...
phporcaffeine Posted July 14, 2009 Share Posted July 14, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/165932-garbled-quotesapostrophes-in-rss-display/#findComment-875357 Share on other sites More sharing options...
Dimwhit Posted July 14, 2009 Author Share Posted July 14, 2009 I'll give that a shot. I do know it's not a Word issue. I specifically wiped it out and typed the original text in from scratch and it still showed up. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/165932-garbled-quotesapostrophes-in-rss-display/#findComment-875375 Share on other sites More sharing options...
Dimwhit Posted July 14, 2009 Author Share Posted July 14, 2009 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). Quote Link to comment https://forums.phpfreaks.com/topic/165932-garbled-quotesapostrophes-in-rss-display/#findComment-875388 Share on other sites More sharing options...
p2grace Posted July 14, 2009 Share Posted July 14, 2009 Do you have a url we can look at? Quote Link to comment https://forums.phpfreaks.com/topic/165932-garbled-quotesapostrophes-in-rss-display/#findComment-875389 Share on other sites More sharing options...
Dimwhit Posted July 14, 2009 Author Share Posted July 14, 2009 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). Quote Link to comment https://forums.phpfreaks.com/topic/165932-garbled-quotesapostrophes-in-rss-display/#findComment-875397 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.