Forum Moderators: coopster
This is the header:
header('Content-type: application/xml; charset="UTF-8"',true);
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<data>';
...and footer:
echo '</data>';die();
Almost everything works great. Just a few hours ago I tested data with special characters (spanish, german and portuguese); and this was the result:
<?xml version="1.0" encoding="UTF-8"?>
<data>
<meta>
<new>2</new>
<total>2</total>
</meta>
<list>
<item>
<id_msg>5</id_msg>
<name>John Smith</name>
<date>02:32</date>
<msg>Im fine. How are you?</msg>
</item>
<item>
<id_msg>15</id_msg>
<name>Roman Polanski</name>
<date>Aug 30</date>
<msg>Hi, these are special characters: spanish ? ? ? ? ?, deutsch ? ?, portuguese ?</msg>
</item>
</list>
</data>
The last <msg> node should contain:
spanish á é í ó ú ñ, german ä ë, portuguese ç
The information that gets served inside the data node comes from a UTF-8 mysql database.
Why are the original characters not getting through?
http://php.net/mysql [php.net]