KodaShuko / magpiephp

Automatically exported from code.google.com/p/magpiephp
0 stars 0 forks source link

Problem with apostrophes #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Whatever the encoding, it seems that magpie can't support apostrophe,
redering them as "?" (literrally, no the little symbol of wrong encoding).

Original issue reported on code.google.com by amadeo%s...@gtempaccount.com on 3 Mar 2007 at 4:50

GoogleCodeExporter commented 8 years ago
Same problem here. Can't use Magpie until this is fixed. It's basically useless.

Original comment by website%...@gtempaccount.com on 23 Mar 2007 at 6:44

GoogleCodeExporter commented 8 years ago
Ditto that here.

Original comment by manofbr...@yahoo.com on 25 Mar 2007 at 2:12

GoogleCodeExporter commented 8 years ago
Tried using UTF-8?

Original comment by cubegames on 26 Jun 2007 at 7:15

GoogleCodeExporter commented 8 years ago
I have this problem with both apostrophes and quotations.  The feed is encoded 
with
UTF-8.

Original comment by pconn...@gmail.com on 11 Jul 2007 at 7:36

GoogleCodeExporter commented 8 years ago
You can add hyphens and "emdashes" to the list as well.  all replaced with a 
question
mark.

Original comment by pconn...@gmail.com on 11 Jul 2007 at 7:40

GoogleCodeExporter commented 8 years ago
I also have this issue.. I looked at the feed source and I am seeing things like
"ZACK & WIKITM: Quest for Barbaros’ Treasure" in the source code, but when
I display it with Magpie, I get "ZACK & WIKI Quest for Barbaros? Treasure" 
instead.

The ampersand works, but the apostraphe or whatever that should be, doesn't 
display.

In case Google doesn't display that as I've typed it out, that question mark at 
the
end of the word Barbaros, in the XML source, is: ampersand, pound sign, 8, 2, 
1, 7,
semi-colon.

Original comment by adol...@gmail.com on 20 Sep 2007 at 4:26

GoogleCodeExporter commented 8 years ago
According to rss_parse.inc L78, Magpie RSS uses ISO-8859-1 as the default 
output encoding because this is 
PHP's default. To force UTF-8 encoding, add this to your page's PHP, before you 
load Magpie RSS:

    define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');

Works a treat for me. (Remember to set your page's charset accordingly, too.)

Original comment by delet...@netcetera.org on 2 Jan 2008 at 11:06

GoogleCodeExporter commented 8 years ago
Thanks for that encoding fix. Works awesome. That's been bugging me for a while.
Arguably this is still a bug, as the class could handle this for you if it when 
it
detects UTF-8.

Original comment by stonehil...@gmail.com on 28 Jan 2008 at 5:22

GoogleCodeExporter commented 8 years ago
Coming from a just-make-it work perspective: The only reason why I used magpie 
was to
avoid reinventing the wheel so you can imagine my frustration when I ran into 
the
same problem with apostrophe, quote, etc characters being displayed as question 
marks
? -- just as some of the users noted previously.

Perhaps my problem might have been self-created since I didn't use magpie's 
fetch
capability (does that make a difference in this case?) - instead I just used its
parse section. In either case, thought I'd share my thoughtless solution.  The
above-mentioned suggestions did not work for me.

I used curl to get the data with:

$scrape_ch = curl_init();
curl_setopt( $scrape_ch, CURLOPT_URL, "blah.rss" )
$scrape = curl_exec( $scrape_ch );

Then I used a cheap trick: str_replace():

$scrape = str_replace( "’", "'", $scrape );   # apostrophe
$scrape = str_replace( "“", "\"", $scrape );  # left ''
$scrape = str_replace( "”", "\"", $scrape );  # right ''

Lastly:

$rss = @new MagpieRSS( $scrape );
var_dump( $rss );

I obviously didn't have too much time to get in the fray: researching various
encodings, accounting for unknowns, do I compile mbstring into PHP, upgrade to 
5,
etc.. so this was the easiest bit to do.  This thing was supposed to work out 
of the
box anyhow - but no two environments are alike, as many of you know.  At any 
rate, my
RSS feed titles started displaying properly after this snippet.

Original comment by pp1...@gmail.com on 18 Mar 2008 at 1:34

GoogleCodeExporter commented 8 years ago
So this was flagged in 2007 and still an issue? I'm assuming that Magpie is 
completely abandoned?

Original comment by Nathan.H...@googlemail.com on 25 Feb 2014 at 10:05