moritz has asked for the wisdom of the Perl Monks concerning the following question:
Most of my CGI scripts follow a common workflow:
My question is: how can I automate step 2, decode the return value of param().
The charset methods seems to affect only the generated header:
!/usr/bin/perl use strict; use warnings; use CGI; use utf8; my $q = new CGI; $q->charset('utf8'); my $str = $q->param('foo'); print utf8::is_utf8($str) ? 1 : 0, "\n"; print $CGI::VERSION, "\n"; __END__ $ perl foo.pl foo=bää 0 3.15
Currently my only idea is to subclass CGI, but somehow I think there should be a better solution. But what is it?
I've read Understanding CGI.pm and UTF-8 handling but it didn't enlighten me.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI.pm: automatically decode param()
by Corion (Patriarch) on Sep 03, 2007 at 09:16 UTC | |
by moritz (Cardinal) on Sep 03, 2007 at 09:38 UTC | |
by Corion (Patriarch) on Sep 03, 2007 at 10:19 UTC | |
by moritz (Cardinal) on Sep 03, 2007 at 10:51 UTC | |
by rhesa (Vicar) on Sep 04, 2007 at 12:02 UTC |