Welcome to WebmasterWorld Guest from 54.145.208.64

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Question mark instead of apostrophe in text

   
5:49 pm on Aug 23, 2007 (gmt 0)

10+ Year Member



I have a php script with an RSS feed that works great, except in the text I get a question mark where there should be an apostrophe. Does anyone know how I can correct that. If so, I appreciate your help.
My script looks like this:

<?php
include('magpierss/rss_fetch.inc');
// Set error reporting for this
//error_reporting(E_ERROR);
// Fetch RSS feed

define('magpierss', 'magpierss/');
require_once(magpierss.'rss_fetch.inc');

$rss = fetch_rss( 'http://www.example.com/services/xml/rss/nyt/Books.xml');

if ($rss)
{
// Split the array to show first 10
$items = array_slice($rss->items, 0, 10);
// Cycle through each item and echo
foreach ($items as $item )
{
echo '<ol><a href="'.$item['link'].'">'.$item['title'].'</a> &nbsp; &nbsp; '.$item['author'].'<br />'.$item['description'].'</ol>';
}}else { echo '<h2>Error:</h2><p>'.magpie_error().'</p>';}
// Restore original error reporting value@ini_restore('error_reporting');
?>
</div>

[edited by: dreamcatcher at 6:05 pm (utc) on Aug. 23, 2007]
[edit reason] Use example.com, thanks. [/edit]

7:36 pm on Aug 23, 2007 (gmt 0)

10+ Year Member



Try this:
echo '<ol>';
foreach ($items as $item )
{
echo '<li><a href="'.$item['link'].'">'.$item['title'].'</a> &nbsp; &nbsp; '.$item['author'].'<br />'.$item['description'].'</li>';
}
echo '</ol>';

I say this because you might want your html markup to look like this:
<ol>
<li>Item in the list 1</li>
<li>Item in the list 2</li>
</ol>

instead of:
<ol> Entirely new list 1</ol>
<ol> Entirely new list 2 </ol>

6:16 am on Aug 24, 2007 (gmt 0)

WebmasterWorld Senior Member vincevincevince is a WebmasterWorld Top Contributor of All Time 10+ Year Member



The problem is almost certainly one of encoding. The encoding with which your pages are being output is not being correctly reported or perhaps it is not supported by the RSS reader.
6:21 pm on Aug 24, 2007 (gmt 0)

10+ Year Member



Thanks to both of you.
I tried what Natural Number suggested --

echo '<ol>';
foreach ($items as $item )
{
echo '<li><a href="'.$item['link'].'">'.$item['title'].'</a> &nbsp; &nbsp; '.$item['author'].'<br />'.$item['description'].'</li>';
}
echo '</ol>';

but it didn't work.

I'm not quite sure what to try next. I'll let you know if I figure it out.

Thanks again.