Ask a Question related to PHP Development, Design and Development.
-
John W. Holmes #1
Re: [PHP] htmlentities -- can it skip tags
Justin French wrote:
You'll have to build one.> Hi all,
>
> I need to convert some text from a database for presentation on
> screen... as per usual, characters like quotes and ampersands (&) are
> giving me grief. the obvious answer is to apply htmlspecialchars(), BUT
> this also converts all < and > into < and > signs, which destroys
> the html mark-up within the text.
>
> Is there a non-tag equivalent of htmlspecialchars(), or do I need to
> build one?
If you know what characters are causing trouble, you could just use
str_replace on them. Or you could use htmlspecialchars() and then run
str_replace to convert < and > back into brackets.
You could also use get_html_translation_table() to get the conversions,
remove the < and > conversion elements of the array and then use strtr()
to do the conversion.
--
---John Holmes...
Amazon Wishlist: [url]www.amazon.com/o/registry/3BEXC84AB3A5E/[/url]
php|architect: The Magazine for PHP Professionals – [url]www.phparch.com[/url]
John W. Holmes Guest
-
How to treat template tags as comment tags?
Hi all, I am using DW MX to edit templates for a FreeMarker application. The template tag fromat is like so: <ul> <#list birds as bird>... -
encodings and htmlentities...
Hi, I have a seamingly simple problem: My databse contains following character: µ. When I put it into xml, xml breaks. I tried using... -
htmlentities adds slashes - why?
Folks, I'm using Apache/1.3.28 (SuSE 7.1, kernal 2.4) with PHP/4.3.2. I have the following code to help cleanse form data. function... -
Using ParseChildren attribute to load child tags - VS removes tags
I am building a poll control, nested in the tag I have child tags to setup the poll options. Everything works fine, but when I edit a property in... -
preg_replace + htmlentities
Sandy Lewanscheck wrote: Replace the "dangerous" chars with "something else" in the replace_url function (like ''), then apply replace_url,... -
Justin French #2
Re: [PHP] htmlentities -- can it skip tags
On Monday, September 15, 2003, at 12:58 PM, John W. Holmes wrote:
Which is what I just did as a 'patch' :)> Justin French wrote:
>>>> Hi all,
>> I need to convert some text from a database for presentation on
>> screen... as per usual, characters like quotes and ampersands (&) are
>> giving me grief. the obvious answer is to apply htmlspecialchars(),
>> BUT this also converts all < and > into < and > signs, which
>> destroys the html mark-up within the text.
>> Is there a non-tag equivalent of htmlspecialchars(), or do I need to
>> build one?
> You'll have to build one.
>
> If you know what characters are causing trouble, you could just use
> str_replace on them. Or you could use htmlspecialchars() and then run
> str_replace to convert < and > back into brackets.
I like that idea a LOT.> You could also use get_html_translation_table() to get the
> conversions, remove the < and > conversion elements of the array and
> then use strtr() to do the conversion.
Thanks John!
Justin
Justin French Guest
-
Justin French #3
Re: [PHP] htmlentities -- can it skip tags
On Monday, September 15, 2003, at 12:58 PM, John W. Holmes wrote:
Which is what I just did as a 'patch' :)> Justin French wrote:
>>>> Hi all,
>> I need to convert some text from a database for presentation on
>> screen... as per usual, characters like quotes and ampersands (&) are
>> giving me grief. the obvious answer is to apply htmlspecialchars(),
>> BUT this also converts all < and > into < and > signs, which
>> destroys the html mark-up within the text.
>> Is there a non-tag equivalent of htmlspecialchars(), or do I need to
>> build one?
> You'll have to build one.
>
> If you know what characters are causing trouble, you could just use
> str_replace on them. Or you could use htmlspecialchars() and then run
> str_replace to convert < and > back into brackets.
I like that idea a LOT.> You could also use get_html_translation_table() to get the
> conversions, remove the < and > conversion elements of the array and
> then use strtr() to do the conversion.
Thanks John!
Justin
Justin French Guest



Reply With Quote

