Page 1 of 1

Convert encoding?

Posted: Fri Jan 29, 2010 10:13 pm
by divito
I'm dealing with MagpieRSS and feeds that I'm trying to parse are encoded with Windows-1252. MagpieRSS can't deal with this encoding and I'm stuck being unable to use the feeds from this one site.

I was wondering what the easiest way to fix this problem might be. Would I go about converting the feeds in question to send to Magpie, and how would that be accomplished? Or might it be easier to alter the Magpie parsing file to deal with it?

Any push in the right direction is greatly appreciated. Hoping this can be remedied in an easier way instead of redoing all my scripts with another parser. :(

Re: Convert encoding?

Posted: Fri Jan 29, 2010 10:46 pm
by Eran
Try using iconv, it covers windows-1252 - only there it's called cp1252.

Code: Select all

$text = iconv('cp1252','utf-8//IGNORE',$text);

Re: Convert encoding?

Posted: Fri Jan 29, 2010 11:22 pm
by divito
Magpie has iconv in it already, but it apparently only deals with the easier encodings. I'm not sure how I'd use your suggestion to put it back into a url, as it seems Magpie doesn't do it any other way. I suppose another option that might work is saving it as a file each time and reading it. Though that will take more research for me to learn.

If only it was as simple as having Magpie ignore the first line where it says the encoding. Of course I had to pick a parser that hasn't been updated in eons.