Page 1 of 1

RSS feeds: pound signs and quotation marks

Posted: Fri May 15, 2009 6:12 am
by lauthiamkok
Hi,

When I pull news items from a RSS feed with MagpieRSS - RSS for PHP.

It seems cannot display the pound signs and quotation marks properly, for instance, it reads,

1. Anti-gay ?Nazi? slur causes Church of Scotland outrage

2. �16million 'Lord of Manor' gave all money to charity - Mirror.co.uk

Instead of,

1. Anti-gay 'Nazi' slur causes Church of Scotland outrage

2. £16million 'Lord of Manor' gave all money to charity

Is there any way I can get around to it?

Many thanks,
Lau

Re: RSS feeds: pound signs and quotation marks

Posted: Fri May 15, 2009 9:01 am
by divito
How are you echoing out the titles?

Re: RSS feeds: pound signs and quotation marks

Posted: Fri May 15, 2009 9:15 am
by lauthiamkok
divito wrote:How are you echoing out the titles?
this is the script that I use,

Code: Select all

<?php
        require_once 'magpierss/rss_fetch.inc';
        
        $url = 'http://pipes.yahoo.com/pipes/pipe.run?_id=a39fa4f77e90609914ad4a1be7b07a9e&_render=rss';
        $rss = fetch_rss($url);
        $items = array_slice($rss->items, 0, 8);
 
        foreach ($items as $item) {
            $title = $item['title'];
            $link   = $item['link'];
            $imageURL   = $rss->image['url'];
            $date = $item['date_timestamp'];
            $desc = $item['description'];
            $source = trim ($link, "http://");
            $source = explode("/", $source);
            $source = $source[0];
            
            /*if (strlen($title) >= 50)
                {
                $title = substr($title,0,49)."...";
                }
            */
            $desc = eregi_replace('<br>',' ', $desc); 
            $desc = strip_tags($desc);
            
            if (strlen($desc) >= 100)
                {
                $desc = substr($desc,0,99)."...";
                }
?>
      <!--item-->
            <div class="item">
                
                <!--item_left-->
                <div class="item_left">
                    <?php if(!empty($imageURL))
                    {
                    ?>
                    <div class="left_img"><img src="<?php echo $imageURL;?>"/></div>
                    <?php
                    }
                    ?>               
                </div>
                <!--item_left-->
                
                <!--item_right-->
                <div class="item_right">
                    <div class="title"><a href="<?php echo $link;?>" target="_blank"><?php echo $title;?></a></div>
                    <div class="desicription"><?php echo $desc;?></div>
                    <div class="date"><strong><?php echo date("j F", $date);?></strong>, <?php echo date("H:i", $date);?></div>
                    <div class="date">source: <a href="http://<?php echo $source;?>"><?php echo $source;?></a></div>
                </div>
                <!--item_right-->
        </div>
    <!--item-->
 
 <?php
            }
            ?>