i am working on a system that uses XML for saving messages, and sometimes costumers send weird sings like a password dot for example which results in a xml parse error with simplexml_load_string, i am using a replace at the moment this works great in most cases:
return str_replace( ["&", "", "<", ">", "`", "~", '"' ], ' ', $text );
so for the password dot i added:
$message = str_replace("•", "", $message);
this works but i am wondering if there is an easier way to fix this instead of replacing everything, or i could only allow certain characters like a-z 0-9 spaces .,./?! etc which worked with preg_replace but then the emoticons from phones etc did not come trough, same for swedish and spanish characters like Å, Ä, Ñ and Ö. thanks!
edit: updated the dot replace that works but doenst fix the xml parse problem when using more weird characters