Xml_parser - problem with char encoding

Hello everyone!

I have a problem with some code that runs differently on PHP5…

I get an external XML feed and parse it in a page…

This feed contains Greek characters and uses ISO-8859-7 encoding…

The same goes for my page…

The code I am using to read the feed is :

$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);

$p = xml_parser_create();
xml_parse_into_struct($p, $data, $vals, $index);

This works perfectly in PHP 4 but in 5, even all the page is in ISO-8859-7 encoding the data taken from XML url are in UTF-8 (if I change the encoding on the browser to UTF-8 the Greek strings from are displayed correctly but all the rest page is garbage)…

The URL for the XML feed is:


and two examples of the output are:


They run the same file but the first server has PHP4 and the 2nd PHP5…

I tried several functions like utf8_encode / utf8_decode / declairing encoding on xml_parser but with no luck…

Any ideas?