A few more common html entities to convert to text

This commit is contained in:
james 2009-12-03 21:13:31 +00:00
parent df3cd54701
commit 617723cdbe

View File

@ -1274,8 +1274,15 @@ function getTextFromHtml($html) {
$text=eregi_replace('<br[[:space:]]*/?[[:space:]]*>',chr(13).chr(10),$text);
//and strip the rest of the tags
$text=strip_tags($text);
//and replace &nbsp;
//a few common html entities
//replace &amp; with & first, so multiply-encoded entities will decode (like "&amp;#160;")
$text=str_replace("&amp;","&",$text);
$text=str_replace("&nbsp;"," ",$text);
$text=str_replace("&#160;"," ",$text);
$text=str_replace("&lt;","<",$text);
$text=str_replace("&gt;",">",$text);
return $text;
}