This is a very handy function if you want to clean up your content before storing it into your database. It uses "eregi_replace" to replace every character with the desired one. I would use it to convert a HTML code to XHTML to make it valid.
It has only 4 characters right now but it can be extended to an unlimited number in order to output a really clean content. I suggest you to go
here if you're looking for more entities to replace.
I will also post a function that adds the characters back to the content for text output in your website. We don't want to force our visitors to try and read/understand all those characters.
function cleanContent($string) {
$string = stripslashes($string);
$string = eregi_replace("'","'",$string);
$string = eregi_replace('"','"',$string);
$string = eregi_replace('?','-',$string);
$string = eregi_replace('?','’',$string);
return $string;
}