AN ongoing issue for over a year, That I though I had corrected but has evolved into a monster.
I move large amounts of data between sites using XML generated on PHP systems. Mainly text I ran into some basic XML items that broke the transfer so I used this code of all XML values.
$value=str_replace("'","'",$value);
print '<'.$key.'>';
print htmlspecialchars($value, ENT_XML1 | ENT_QUOTES, 'UTF-8');
print '</'.$key.'>';
$key being the field and this works perfectly for all data except for anyting containing an accent such as piñata. A value with the ñ character shows as completely empty.
I have yet to locate a function to clean text for XML formatting with PHP. I currently dump data from a database into this format, then load into SImpleXML on the receiving side to load back into a database.
A solution by either cleaning all data or possibly json encoding instead of XML possibly would be fantastic.
Thanks-Chris