note 65702 added to function.htmlentities
| From: | cameron at prolifique dot com | Date: | Sat, 06 May 2006 00:02:26 +0000 |
| Subject: | note 65702 added to function.htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-110671@lists.php.net to get a copy of this message | ||
I've been dissatisfied with all the solutions I've yet seen for converting text into html
entities, which all seem to have some drawback or another. So I wrote my own, borrowing heavily from
other code posted on this site.
http://www.prolifique.com/entities.php.txt
makeSafeEntities() should take any text, convert it from the specified charset into UTF-8, then
replace all inappropriate characters with appropriate (and legal) character entities, returning
generic ISO-8859 HTML text. Should NOT reconvert any entities already in the text.
makeAllEntities() does the same, but converts the entire string to entities. Useful for obscuring
email addresses (in a lame but nonetheless somewhat effective way).
Suggestions for improvement welcome!
----
Server IP: 216.194.113.175
Probable Submitter: 68.6.44.131
----
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.htmlentities.php
Edit -- http://master.php.net/note/edit/65702
Del: integrated -- http://master.php.net/note/delete/65702/integrated
Del: useless -- http://master.php.net/note/delete/65702/useless
Del: bad code -- http://master.php.net/note/delete/65702/bad+code
Del: spam -- http://master.php.net/note/delete/65702/spam
Del: non-english -- http://master.php.net/note/delete/65702/non-english
Del: in docs -- http://master.php.net/note/delete/65702/in+docs
Del: other reasons-- http://master.php.net/note/delete/65702
Reject -- http://master.php.net/note/reject/65702
Search -- http://master.php.net/manage/user-notes.php