note 52116 deleted from function.htmlentities by mazzanet
| From: | mazzanet@php.net | Date: | Mon, 03 Oct 2005 21:07:42 +0000 |
| Subject: | note 52116 deleted from function.htmlentities by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96319@lists.php.net to get a copy of this message | ||
Note Submitter: marques at displague dot com
----
Re: htmlEncodeText (see below)
<? // added: plus, comma, and tilde - for home dirs and query strings
$pattern = '<([a-zA-Z0-9\.\, "\'_\/\-\+~=;:\(\)?&#%![\]@]+)>'
...
// also, I found the htmlentities call was more useful with UTF-8 output
$textMatches [$key] = htmlentities ($value,ENT_COMPAT,'UTF-8'); ?>
By forcing UTF-8 output, the rest of the page will probably want an UTF-8 character set defined in
the header or by an html meta tag. Optionally, you can set it per element with a charset
(http://www.w3.org/TR/REC-html40/types.html#h-6.9) tag attribute.