note 92104 added to function.htmlentities
| From: | brianhamner at yahoo dot com | Date: | Thu, 09 Jul 2009 04:26:44 +0000 |
| Subject: | note 92104 added to function.htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158089@lists.php.net to get a copy of this message | ||
If you want something simple that actually works, try this. Strips MS word and other entities and
returns a clear data string:
//call this function
function DoHTMLEntities ($string) {
$trans_tbl[chr(145)] = '‘';
$trans_tbl[chr(146)] = '’';
$trans_tbl[chr(147)] = '“';
$trans_tbl[chr(148)] = '”';
$trans_tbl[chr(142)] = 'é';
$trans_tbl[chr(150)] = '–';
$trans_tbl[chr(151)] = '—';
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(" & ","&",$foo2);
echo DoHTMLEntities ($foo3);
----
Server IP: 64.71.164.2
Probable Submitter: 68.62.120.75
----
Manual Page -- http://www.php.net/manual/en/function.htmlentities.php
Edit -- https://master.php.net/note/edit/92104
Del: integrated -- https://master.php.net/note/delete/92104/integrated
Del: useless -- https://master.php.net/note/delete/92104/useless
Del: bad code -- https://master.php.net/note/delete/92104/bad+code
Del: spam -- https://master.php.net/note/delete/92104/spam
Del: non-english -- https://master.php.net/note/delete/92104/non-english
Del: in docs -- https://master.php.net/note/delete/92104/in+docs
Del: other reasons-- https://master.php.net/note/delete/92104
Reject -- https://master.php.net/note/reject/92104
Search -- https://master.php.net/manage/user-notes.php