Reputation: 1688
I get data from My DB, when I show it on browser windows it was correctly encoded, but when i saved into xml file I get data with encoding changed. for exemple : on browser I get this text `
Un texte est une série orale ou écrite de mots perçus comme constituant un ensemble cohérent, porteur de sens et utilisant les structures propres à une langue à là-bas oç ôlala îlolo (conjugaisons, construction et association des phrases…)
on xml file I get :
<p>Un texte est une série orale ou écrite de <em>mots</em> perçus comme constituant un ensemble cohérent, porteur de sens et utilisant les structures propres à une langue à là-bas oç <strong>ôlala</strong> îlolo (conjugaisons, construction et association des phrases…)</p>
I don't know what's the problem !!
Upvotes: 1
Views: 43
Reputation: 1688
I solved My problem with encoding this text and deleting the html tag :
$description = strip_tags($value['Description']);
$description = preg_replace("/&#?[a-z0-9]+;/i","",$description);
$xml->startElement("description");
$xml->writeRaw(htmlspecialchars_decode($description));
$xml->endElement();
now I have a xml file completely correct.
Upvotes: 1
Reputation: 2173
It's an htmlentities convertion , place your html content into cdata tag if you want to keep htmlentities <![CDATA[ <p>myhtmlcontent</p>]]>
Upvotes: 0