Re: Escaping php content output for valid html
| From: | Jason Wong | Date: | Fri, 16 Apr 2004 12:57:56 +0000 |
| Subject: | Re: Escaping php content output for valid html | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183618@lists.php.net to get a copy of this message | ||
On Friday 16 April 2004 20:19, Merlin wrote:
> hmm so you would suggest to save the entitty code directly to the database
> in the first place?
If the data is mainly displayed as HTML then yes, store the HTML entities and
do a conversion when you want plain text or whatever.
> What happens if I want to use the text for something
> else, lets say print outs, or the entity code changes over the years,
> respectively the browsers comming up with new technologies and dropping the
> old standards?
Do a conversion.
> Another thing I do not understand concerning php, if this is that
> important, why is there not a function who does this? something like
> ent_replace()? Do I have to write a str_replace statement for all the
> entity characters? If yes, does anybody already have such a code line? It
> sounds to me that this is like inventing the wheel over and over again?
Well if PHP had a function for everything that could be done in a line or two
of code then it would have more functions than I could count on my fingers
and toes.
This might help, get_html_translation_table().
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Words have a longer life than deeds.
-- Pindar
*/