?
Solved

cannot replace ? with £ in external RSS feed

Posted on 2007-04-03
4
Medium Priority
?
245 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

719 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