htmlentities / html_entity_decode

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sylvian stone

    htmlentities / html_entity_decode

    Hi,

    I've been having problems encoding / decoding data, and can't seem to
    figure out where I am going wrong.

    I extract data from a mysql table with a line like:

    $object_name[$a] = stripslashes(ht mlspecialchars( $row['object_name'],
    ENT_QUOTES));


    so an entry called, say, '"Y" axis' becomes '"Y&quot ; axis'

    OK so far...but when I use the line below to decode:

    echo html_entity_dec ode($object_nam e[$z], ENT_QUOTES);

    it stills reads it out as : '"Y&quot ; axis'


    What point am I missing here ?


    Thanks
    SS.

  • Steve

    #2
    Re: htmlentities / html_entity_dec ode

    The html_entity_dec ode function is a newer function. Try this if you
    are using an older version of PHP:

    // For users prior to PHP 4.3.0 you may do this:
    function unhtmlentities( $string)
    {
    $trans_tbl = get_html_transl ation_table(HTM L_ENTITIES);
    $trans_tbl = array_flip($tra ns_tbl);
    return strtr($string, $trans_tbl);
    }

    Comment

    Working...