[cgiapp] UTF-8 output

Michael Lackhoff lackhoff at zbmed.uni-koeln.de
Mon Nov 2 11:38:27 EST 2009


On 02.11.2009 16:21 Emmanuel Seyman wrote:

>>From CGI.pm :
> 
>     # set charset to the safe ISO-8859-1
>     $self->charset('ISO-8859-1');
> 
> http://cpansearch.perl.org/src/LDS/CGI.pm-3.48/lib/CGI.pm

Thanks for the hint! But isn't it better then to tackle the problem
right at the root:
$webapp->query->charset('UTF-8'); # works!

> I always add the following line :
> 
> $webapp->header_add(-charset => 'UTF-8');

because this would set the header twice, first from CGI.pm to ISO-8859-1
then from the webapp to UTF-8 (no big deal but still) or are there other
reasons why header_add is better?

But since this is more or less academic because both approaches work, I
would be much more interested in good ways to deal with the decoding of
CGI-params and the encoding of TT-templates ;-)

-Michael


More information about the cgiapp mailing list