Codice PHP:
function specialchars2html($str){
   
$tt=array_flip(get_html_translation_table(HTML_ENTITIES));
   return 
strtr($str$tt);