note 62555 deleted from function.htmlspecialchars by cmb
| From: | cmb@php.net | Date: | Sun, 27 Oct 2019 09:16:43 +0000 |
| Subject: | note 62555 deleted from function.htmlspecialchars by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212847@lists.php.net to get a copy of this message | ||
Note Submitter: richard at mf2fm dot com
----
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