Solved

cannot replace ? with £ in external RSS feed

Posted on 2007-04-03
4
242 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

Suggested Solutions

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

734 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