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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pbb
Forum Newbie
Posts: 2
Joined: Wed Jan 16, 2008 3:49 am

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

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

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

Post 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.
devendra-m
Forum Contributor
Posts: 111
Joined: Wed Sep 12, 2007 3:16 am

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

Post by devendra-m »

utf8_encode
pbb
Forum Newbie
Posts: 2
Joined: Wed Jan 16, 2008 3:49 am

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

Post by pbb »

devendra-m wrote:utf8_encode
Thanks! utf8_encode() did the trick :D
Post Reply