I try to find a solution by extracting sql table values in utf8 encoding but no luck. The bellow code exports a right XML file named "test.xml" but without encoding. Any suggestions?
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "admin";
$dbname = "My_DB";
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
$sql = "SELECT product_id, model, image FROM product";
$q = mysql_query($sql)or die(mysql_error());
$xml = "<products>";
while($r = mysql_fetch_array($q)){
$xml .= "<product>";
$xml .= "<id>";
$xml .= "<![CDATA[".$r["product_id"]."]]>";
$xml .= "</id>";
$xml .= "<name><![CDATA[" . $r["model"] . "]]></name>";
$xml .= "<image>".$r['image']."</image>";
$xml .= "</product>";
}
$xml .= "</products>";
$sxe = new SimpleXMLElement($xml);
$sxe->asXML("test.xml");
?>