[cgiapp] UTF-8 output

Mike Tonks fluffymike at googlemail.com
Thu Nov 19 06:50:03 EST 2009


I have the following in my cgiapp_init:

	binmode STDOUT, ":utf8"; # Explicitly output utf8 - this is critical

probably totally wrong, but it works for me...




2009/11/4 Michael Lackhoff <lackhoff at zbmed.uni-koeln.de>:
> On 04.11.2009 12:19 Cees Hek wrote:
>
>> You mean something like this:
>>
>> __PACKAGE__->add_callback('postrun', sub {
>>     my $self = shift;
>>
>>     # Make sure the output is utf8 encoded if it needs it
>>     if ( $_[0] && ${$_[0]} && utf8::is_utf8(${$_[0]}) ){
>>         utf8::encode( ${$_[0]} );
>>     }
>>
>>     return;
>> });
>>
>> I have that in my CGI::App base class.
>
> As time goes by my base class gets more and more pieces of yours ;-)
>
> Thanks
> -Michael
>
> #####  CGI::Application community mailing list  ################
> ##                                                            ##
> ##  To unsubscribe, or change your message delivery options,  ##
> ##  visit:  http://lists.openlib.org/mailman/listinfo/cgiapp    ##
> ##                                                            ##
> ##  Web archive:   http://lists.openlib.org/pipermail/cgiapp/   ##
> ##  Wiki:          http://cgiapp.erlbaum.net/                 ##
> ##                                                            ##
> ################################################################
>
>


More information about the cgiapp mailing list