Page 1 of 1

How do I combine UTF-8 and ISO-8859-1 results from CURL ?

Posted: Wed Jan 16, 2008 3:55 am
by pbb
Hi,

I am relatively new to PHP. I need to combine information from various sites, which I retrieve using CURL. However, some sites return text coded in UTF-8 while others return ISO-8859-1. The result is that all special (accented) characters from the latter sites get mangled when I combine the results in UTF-8.

Is there a way in PHP to convert ISO-8859-1 text to UTF-8?

Thanks, Peter

Re: How do I combine UTF-8 and ISO-8859-1 results from CURL ?

Posted: Wed Jan 16, 2008 4:03 am
by Chris Corbyn
Take a look at the mb_*() (MB String) functions, iconv(), utf8_decode() and others ;) Your safest bet is probably to try and turn everything into UTF-8.

Re: How do I combine UTF-8 and ISO-8859-1 results from CURL ?

Posted: Wed Jan 16, 2008 4:05 am
by devendra-m
utf8_encode

Re: How do I combine UTF-8 and ISO-8859-1 results from CURL ?

Posted: Wed Jan 16, 2008 5:34 am
by pbb
devendra-m wrote:utf8_encode
Thanks! utf8_encode() did the trick :D