Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

(un)escaping html with cgi.pm

by kb2yht (Acolyte)
on Sep 20, 2004 at 16:41 UTC ( [id://392410]=perlquestion: print w/replies, xml ) Need Help??

kb2yht has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, Have a little problem i can not seems to find an answer to in the library or in CPAN docs. I'me using cgi.pm for a data-base backended set of scripts, In one on the tables I am returned a set of pre-htmlised strings to use as the labels of a CGI::popup_menu. It seems that CGI.pm or at least the popup menu function escapes the strings in a -label=> hash so that
$->popup_menu("fooname",\%db_return_hash,"default"); if "fooébar" is returned as eiter a name or a value in db_return_hash it becomes "fooébar"
Any help or pointers would be a great help, Kb2yht

Replies are listed 'Best First'.
Re: (un)escaping html with cgi.pm
by Velaki (Chaplain) on Sep 20, 2004 at 16:52 UTC

    You should be able to turn off the feature known as autoEscape as per the module CGI prior to creating your popup, and then turn it back on afterwards, so it would look something like this:

    $query->autoEscape(0); # turn it off $query->popup_menu("fooname",\%db_return_hash,"default"); $query->autoEscape(1); # turn it back on

    Hope that helped,
    -v
    "Perl. There is no substitute."
      Much thanks, I some how missed the autoEscape call in my reading.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://392410]
Approved by Velaki
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-23 19:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found