encoding problems with simplexml functions

A

Anonymous

Guest
NOTE:
You should read this post in encoding ISO-8859-10;


I've began exploring PHP5's new simplexml functions, but there's something wrong when reading an xml file with nordic letters. (æ, ø, å). How do I force the parser to read in ISO-8859-10 mode?

Here's my PHP file:
Code:
<?php

$f = simplexml_load_file('http://www.dagbladet.no/rss/oppdatert.xml');

/* DEBUG

echo '<pre>';
print_r($f);
echo '</pre>';


echo '<hr />';
*/





echo '<hr />';


echo 'Head: ';
foreach($f->channel as $f2)
{
echo '<div>tittel: '       . $f2->title          . '</div>';
echo '<div>link: '         . $f2->link           . '</div>';
echo '<div>beskrivelse: '  . $f2->description    . '</div>';
}

echo '<hr />';

echo 'Body: ';

foreach($f->item as $item)
{



echo '<div>tittel: '      . $item->title       . '</div>';
echo '<div>link: '        . $item->link        . '</div>';
echo '<div>beskrivelse: ' . $item->description . "</div><hr />\n\n";

}


?>
this outputs::

(...)
Amerikanske soldater drepte to etter at det brøt ut en slåsskamp mellom flere fanger i dag. (...)

When it really should have been
(...)
Amerikanske soldater drepte to etter at det brått ut en slåsskamp mellom flere fanger i dag. (...)
 
put this...
Code:
<?xml version="1.0" encoding="iso-8859-10"?>
 
but be sure the editor you work...
Is saving the files in the coding mentioned above.
 
Thanks, but it didn't work. But I figured it out, I just used the utf8_decode() function
 
Back
Top