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

hi Monks, what is the proper way to decode $pjx->js_encode_function('encodeURIComponent'); in my perl code? This function does the proper encoding for me, but if I use it, other things break, such as: my $args = $r->args() , which becomes empty:(

sub request_handler{ my ($r) = @_; my $args = $r->args(); my $hostname = $r->hostname(); $cgi = new CGI; $cgi->charset('UTF-8'); my $pjx = CGI::Ajax->new( 'myFunc' => $get_response ); $pjx->js_encode_function('encodeURIComponent'); my $html = $pjx->build_html( $cgi, $show_html, {'-charset' => 'UTF +-8' , '-Cache-Control' => 'no-cache, must-revalidate'} ); $r->print($html ); return OK; }

Thanks

Replies are listed 'Best First'.
Re: CGI::Ajax and encodeURIComponent
by Khen1950fx (Canon) on Apr 11, 2008 at 08:43 UTC
    For a simplified example, I used this:
    #!/usr/bin/perl use strict; use warnings; use CGI; use CGI::Ajax; my $cgi = new CGI; my $pjx = CGI::Ajax->new( 'myFunc' => \&request_handler ); $pjx->js_encode_function( 'encodeURIComponent' ); print $pjx->build_html( $cgi, \&Show_HTML, { '-charset' => 'UTF-8', '- +Cache-Control' => 'no-cache, must revalidate' }); sub request_handler { #more work here }