note 62555 added to function.htmlspecialchars
| From: | richard at mf2fm dot com | Date: | Fri, 03 Mar 2006 09:06:21 +0000 |
| Subject: | note 62555 added to function.htmlspecialchars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104748@lists.php.net to get a copy of this message | ||
I had a script which detected swearing and wanted to make sure that words such as 'f ü
c k' didn't slip through the system.
After using htmlentities(), the following line converts most extended alphabet characters back to
the standard alphabet so you can spot such problems..
$text=eregi_replace("&([a-z])[a-z0-9]{3,};", "\\\\1", $text);
This changes, for example, 'ü' into 'u' and 'ß' into
's'. Sadly it also converts '£' and '¶' into
'p' so it's not perfect but does solve a lot of the problems
----
Server IP: 216.194.113.175
Probable Submitter: 62.253.64.18 (proxied: 82.20.49.212)
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.htmlspecialchars.php
Edit -- http://master.php.net/note/edit/62555
Del: integrated -- http://master.php.net/note/delete/62555/integrated
Del: useless -- http://master.php.net/note/delete/62555/useless
Del: bad code -- http://master.php.net/note/delete/62555/bad+code
Del: spam -- http://master.php.net/note/delete/62555/spam
Del: non-english -- http://master.php.net/note/delete/62555/non-english
Del: in docs -- http://master.php.net/note/delete/62555/in+docs
Del: other reasons-- http://master.php.net/note/delete/62555
Reject -- http://master.php.net/note/reject/62555
Search -- http://master.php.net/manage/user-notes.php