I would like to switch the encoding of my app from latin1 to UTF-8 and
got it going somehow but am not sure if I am doing it right.

These are my changes in my base class

# seems to be necessary for form input
use CGI '-utf8';

# is there no better way?
sub tt_post_process {
    my $self    = shift;
    my $htmlref = shift;
    utf8::encode($$htmlref);
}

sub cgiapp_init {
    ...
    $self->header_add(-charset => 'utf-8');
}

I am using CAP::Dispatch and the TT-plugin. Without the header_add I get
a HTTP header with an ISO-8859-1 charset definition so the browser
thinks it is latin1 and even a
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
in the template won't help.

And is there no better way for the template output than to post_process
the whole template? Is there no way to get the output of tt_process as
UTF-8 so that there is no post_processing necessary?

Any comments?

Thanks
-Michael


#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

Reply via email to