Re: UTF8 under Perl 5.6.1
Michele Beltrame <mb-pzZ8rf8/[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.petal |
|---|---|
| Message-ID | <[email protected]> |
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