note 92104 deleted from function.htmlentities by cmb

From: Date: Sun, 01 Dec 2019 08:32:13 +0000
Subject: note 92104 deleted from function.htmlentities by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213301@lists.php.net to get a copy of this message
Note Submitter: brianhamner at yahoo dot com ---- If you want something simple that actually works, try this. Strips MS word and other entities and returns a clear data string: <?php //call this function function DoHTMLEntities ($string) { $trans_tbl[chr(145)] = '&#8216;'; $trans_tbl[chr(146)] = '&#8217;'; $trans_tbl[chr(147)] = '&#8220;'; $trans_tbl[chr(148)] = '&#8221;'; $trans_tbl[chr(142)] = '&eacute;'; $trans_tbl[chr(150)] = '&#8211;'; $trans_tbl[chr(151)] = '&#8212;'; return strtr ($string, $trans_tbl); } //insert your string variable here $foo = str_replace("\r\n\r\n","",htmlentities($your_string)); $foo2 = str_replace("\r\n"," ",$foo); $foo3 = str_replace(" & ","&amp;",$foo2); echo DoHTMLEntities ($foo3); ?>

« previous php.notes (#213301) next »