views:

131

answers:

2

Hello Everyone,

I have a problem with reading an rss feed in my site.

When i add an feed to my site I cache it in the database by serializing it and when I do a refresh I unserialize it again from the database if it is within a certain time limit. Else I read again the feed from the remote site.

I think the problem has to do with the feed itself (which comes from a different site which I maintain)

It contains news items from an database with a latin 1 charachterset .

So when I create the feed i do:

iconv("latin-1","UTF-8",$row["intro"])

But when i unserialize the content on my site I get the following notice:

Notice: unserialize() [function.unserialize]: Error at offset 621 of 2464 bytes in /home/site/www/plugins/widgets/rss_reader/lib_rssreader.php on line 25

any idea's?

--New Information --

from the feed the euro sign is represented as a euro sign. The table in wich the feed is chached is utf 8. I thought about using iconv to convert the iso-8859 to utf-8 but i read on the php site that this is not going to work for the euro sign. so this is not going to take me anywhere.

+1  A: 

Is it possible to use UTF-8 all the way? Since you control both sites I would think it would. In my experience sticking with UTF-8 consistently is best.

Josh
the feed is iso 8859-1 and the reading part is utf.
sanders
+1  A: 

Could you use utf8_encode instead - or perhaps in addition to iconv? This function is specifically for encoding of ISO-8859-1 to UTF-8.

BrynJ
I tried this but this doesn't help me for the euro sign.I updated my start post.
sanders
According to this link http://www.phpbuilder.com/manual/en/function.htmlentities.php the Euro symbol isn't supported by ISO-8859-1, but only by the ISO-8859-15 variant. Is that related to your issue? Just a thought but could you use htmlentities on the data and / or str_replace the euro symbols with € or €?
BrynJ