Page 1 of 1

Different Encoding rss feed & web site PROBLEM !?

Posted: Thu Sep 11, 2008 4:10 pm
by soulmasta
Hello all,

i would like to ask ,

when we parse an xml rss feed and we are taking some data (par example: actual weather, news headlines etc etc) for our web site and the rss feed's encoding is ISO or windows, but, our web site's encoding is UTF-8 ..what we can do on this point to make the data that we are getting from the feed visible on our website ?

Cause when the feed's encoding is ISO or windows and our site's encoding is UTF-8 the data that we want to appear on our website will not appear correctly !

How we can solve problem such as this one ?

please help ..am waiting for your answers ;)

Re: Different Encoding rss feed & web site PROBLEM !?

Posted: Thu Sep 11, 2008 5:16 pm
by soulmasta
in otherwords,

how we can convert the encoding type of our rss feed, so that will be the same encoding type with our page's encoding type ?

How we can convert our windows or ISO rss feed to UTF-8 ..????

:roll:

Re: Different Encoding rss feed & web site PROBLEM !?

Posted: Fri Sep 12, 2008 1:04 pm
by dml
Have you tried using iconv?

Re: Different Encoding rss feed & web site PROBLEM !?

Posted: Fri Sep 12, 2008 5:42 pm
by André D
Like dml said, iconv() is the PHP function to use to convert a string from one character encoding to another.

I've done some tests with iconv('ISO-8859-1', 'UTF-8', ...) and have found the results to be imperfect. There were some characters in the input ISO-8859-1 string that did not get converted, even though UTF-8 supports them. I'm not sure, but it might be a problem with the character collations in my locale. I'll post the results of my test on here when I have more time.

Re: Different Encoding rss feed & web site PROBLEM !?

Posted: Thu Sep 18, 2008 9:06 pm
by André D
If your source string is always encoded as ISO-8859-1 you should use utf8-encode() instead of iconv() to perform the conversion to UTF-8.