note 41152 added to function.htmlentities
| From: | wwb at 3dwargamer dot net | Date: | Wed, 31 Mar 2004 21:49:59 +0000 |
| Subject: | note 41152 added to function.htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67432@lists.php.net to get a copy of this message | ||
htmlentites is a very handy function, but it fails to fix one thing which I deal with alot: word
'smart' quotes and emdashes.
The below function replaces the funky double quotes with ", funky single quotes with
standard single quotes and fixes emdashes.
function CleanupSmartQuotes($text)
{
$badwordchars=array(
chr(145),
chr(146),
chr(147),
chr(148),
chr(151)
);
$fixedwordchars=array(
"'",
"'",
'"',
'"',
'—'
);
return str_replace($badwordchars,$fixedwordchars,$text);
}
----
Manual Page -- http://www.php.net/manual/en/function.htmlentities.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41152
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41152&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41152&report=yes
Search -- http://master.php.net/manage/user-notes.php