homepage Welcome to WebmasterWorld Guest from 184.73.52.98
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Question mark instead of apostrophe in text
Ann_G




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

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]

 

natural number




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

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>

vincevincevince




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

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.

Ann_G




msg:3431445
 6:21 pm on Aug 24, 2007 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved