Solved

cannot replace ? with £ in external RSS feed

Posted on 2007-04-03
4
243 Views
Last Modified: 2008-02-26
ive got a RSS feed displaying on the frontpage of this site:

http://www.quest-recruiting.com/

notice that the £ signs show as ? .  im using magpie rss feed scripts and they work well except i cant seem to get the ? replaced with a £ or £!!  I have tried everything:

$url = 'http://business.scotsman.com/topics.cfm?format=rss&tid=181';
$rss = fetch_rss($url);
$limit = rand(0,count($rss->items));

foreach($rss->items as $item)
{
      $rss_description = $item['description'];
      $rss_title = $item['title'];
      
      /*
      $rss_title = str_replace('‘',''',$rss_title);                  
      $rss_title = str_replace('’',''',$rss_title);                
      $rss_title = str_replace('‚',',',$rss_title);                
      $rss_title = str_replace('“','"',$rss_title);                
      $rss_title = str_replace('”','"',$rss_title);                
      $rss_title = str_replace('"','"',$rss_title);                                           
      $rss_title = str_replace('¼','¼',$rss_title);                     
      $rss_title = str_replace('½','½',$rss_title);        
      $rss_title = str_replace('¾','¾',$rss_title);
      $rss_title = str_replace("'","'",$rss_title);
      $rss_title = str_replace('—','-',$rss_title);
      $rss_title = str_replace(' — ',' - ',$rss_title);
      $rss_title = str_replace('  ',' ',$rss_title);
      $rss_title = str_replace('£','£',$rss_title);
      */
      
      $rss_title = str_replace('?','£',$rss_title);
      
      $rss_description = removeEvilTags($rss_description);
      
      /*
      $rss_description = str_replace('‘',''',$rss_description);                  
      $rss_description = str_replace('’',''',$rss_description);                
      $rss_description = str_replace('‚',',',$rss_description);                
      $rss_description = str_replace('“','"',$rss_description);                
      $rss_description = str_replace('”','"',$rss_description);                
      $rss_description = str_replace('"','"',$rss_description);                                           
      $rss_description = str_replace('¼','¼',$rss_description);                     
      $rss_description = str_replace('½','½',$rss_description);        
      $rss_description = str_replace('¾','¾',$rss_description);
      $rss_description = str_replace("'","'",$rss_description);
      $rss_description = str_replace('—','-',$rss_description);
      $rss_description = str_replace(' — ',' - ',$rss_description);
      $rss_description = str_replace('  ',' ',$rss_description);
      $rss_description = str_replace('£','£',$rss_description);
      */
      
      $rss_description = str_replace('?','£',$rss_description);
      
      $s_HtmlContent .= '<h3 class="news_feeds"><a href="'.$item['link'].'" title="'.$rss_title.'" onclick="javascript:window.open(this.href);return false;">'.$rss_title.'</a></h3>'."\n";
      $s_HtmlContent .= '<p class="news_feeds">'.nl2br($rss_description).'</p>'."\n";
      
      if(--$limit < 1)
      {
            break;
      }
}

the removeEvilTags() function just remove <img> tags and other tags that i dont want...

please help.
0
Comment
Question by:ellandrd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
richswyatt earned 500 total points
ID: 18842744
I would try using the html_entities or html_special_chars function on $rss_description PRIOR to the str_replaces.

This will ensure that the symbol is in a format that can be 'found' in the str_replace. I've run into this before and that was the solution.

~Rich
0
 
LVL 16

Author Comment

by:ellandrd
ID: 18842769
i will give it a try. if it works i will kick myself as i never though of trying these functions....
0
 
LVL 16

Author Comment

by:ellandrd
ID: 18842874
htmlentities() worked!

thank you so much!
0
 
LVL 5

Expert Comment

by:richswyatt
ID: 18842879
You're welcome. The little things always get us. :-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question