[Petal] UTF8 under Perl 5.6.1
Michele Beltrame
mb at italpro.net
Mon Feb 28 15:47:55 GMT 2005
Hi!
> Can someone tell me if UTF8 works reliably under Perl 5.6.1? My initial
> experience is that it doesn't (I get the white question mark inside a
> diamond character instead of nbsp chars). Changing the output header
> back to iso8859-1 made those go away. What is the recommned output
> header when using Petal 2+ under Perl 5.6.1?
One of the main problem I experience (also with perl 5.8.x) is that
Petal doesn't always send his output in UTF-8, regardless of what you
specify in its configuration and regardless of any "use utf8" and "use
encoding 'utf8'". To fix this I subclassed Petal (after JM Hiver
suggestion) as follows:
package Petal::AlwaysUTF8;
use strict;
use base qw /Petal/;
use Encode;
sub process
{
my $self = shift;
my $res = $self->SUPER::process (@_);
return Encode::encode ('utf8', $res);
#return $res;
}
You then use this instead of Petal when iniziazing your Petal object. It
will output everything in UTF-8.
Hope this helps!
Michele.
--
Michele Beltrame
http://www.massainforme.it/mb/
ICQ# 76660101
Informativa privacy: http://www.italpro.net/em.html
More information about the Petal
mailing list