Html_entity_decode problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am trying to echo out the following html fragment...

Any ideas why html_entity_decode is not decoding the ' symbols on
the onclick attribute?



    $html_fragment="&lt;input type=&quot;button&quot;
value=&quot;Yes&quot; onclick=&quot;hidePopup
    echo html_entity_decode($html_fragment);


Re: Html_entity_decode problem

Mark Smith escribió:
Quoted text here. Click to load it

 From manual:

string html_entity_decode ( string $string [, int $quote_style=
ENT_COMPAT [, string $charset ]] )
html_entity_decode() is the opposite of htmlentities() in that it
converts all HTML entities to their applicable characters from string .

... and:

ENT_COMPAT Will convert double-quotes and leave single-quotes alone.

The &#039; entities represent single quotes. Try:

echo html_entity_decode($html_fragment, ENT_QUOTES);

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor satinado:

Re: Html_entity_decode problem

On Aug 13, 11:06=A0am, "=C1lvaro G. Vicario"
Quoted text here. Click to load it

Thanks, that was it!

Is there a reason why normally single quotes should be left encoded?

Re: Html_entity_decode problem

On Thu, 13 Aug 2009 12:06:35 +0200, "Álvaro G. Vicario"

Quoted text here. Click to load it

You might also want to take a look at the "get_html_translation_table"
function for a more in-depth look at what is being translated into

Site Timeline