probléme accents dans rss xml
Bonjour,
mon probléme est le suivant :
J'ai un fichier maj-rss.php qui me génére un fichier fluxrss.xml en allant chercher les 5 derniéres nouveautés dans ma base.
In ne gére pas les accents ! comment faire pour éviter cette erreur ?
Merci de votre aide
Maj-rss.php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| <?php
$xml = '<?xml version="1.0" encoding="iso-8859-1"?><rss version="2.0">';
$xml .= '<channel>';
$xml .= '<title>Militaria.fr</title>';
$xml .= '<link>http://www.militaria.fr</link>';
$xml .= '<description>Achat et vente de militaria de collection </description>';
$xml .= '<copyright>© Militaria.fr</copyright>';
$xml .= '<language>fr</language>';
$xml .= '<image>';
$xml .= ' <title>Militaria.fr</title>';
$xml .= ' <url>http://www.militaria.fr/rss/rss.gif</url>';
$xml .= ' <link>http://www.Militaria.fr</link>';
$xml .= '</image>';
$jourdui= date("D d M Y -- H:i:s");
$xml .= '<pubdate>'.$jourdui.'</pubdate>';
require ('connect.php');
$res=mysql_query("select * from kpro_shop_articles order by id desc limit 0, 5") or die(mysql_error());
echo mysql_num_rows($res);
// extraction des 5 dernièrs articles
while($lig=mysql_fetch_array($res)){
$title=$lig[title];
$adresse=$lig[adresse];
$descr=$lig[descr];
$madate=$lig[jourdui];
$datephp=date("D, d M Y H:i:s ", strtotime($madate));
$xml .= '<item>';
$xml .= '<title><![CDATA['.$title.']]></title>';
$xml .= '<link>'.$adresse.'</link>';
$xml .= '<pubDate><![CDATA['.$jourdui.']]></pubDate>';
$xml .= '<description><![CDATA['.$descr.']]></description>';
$xml .= '</item>';
}
$xml .= '</channel>';
$xml .= '</rss>';
$fp = fopen("fluxrss.xml", 'w+');
fputs($fp, $xml);
fclose($fp);
echo 'Export XML effectue !<br><a href="fluxrss.xml">Voir le fichier</a>';
?> |
>> Dans "description", il ne gére pas les accents
a quel endroit le placer ?
Merci de ta réponse.
Dans description, c'est le descriptif de l'objet en détails, dans mon site, cela ressort cool, mais pas dans le xml.
Ma question est ou dois je placer exactement la fonction "htmlspecialchar"?
Merci encore pour ton aide