[Petal] More on entities and Â

Michele Beltrame mb at italpro.net
Tue May 4 09:15:02 BST 2004


Hi!

> Thanks for the quick response. How do I know what my output encoding is?

Perl does exactly what he wants, that is to says it sets the encoding
depending on the input: if there are wide charachters it goes with UTF8,
otherwise it stays with ISO8859-1. At list, this is what happens in
my Slackware 9.1's Perl 5.8.3.

> I can set the encoding of the file and the meta tag. Should I be
> modifying the configuration of my Apache server?

First of all you need to ensure your output it UTF8:

use Encode;
my $string = $template->process (%stuff);
$string = Encode::encode ('utf8', $string);

If you don't want to use this every time you output a template, you
can subclass Petal and override process() method. See a recent message
about Jean-Michel Hiver about this.

There are two ways, and you probably should use both. First of all there's
the header:

Content-type: text/html; charset=utf-8;

However, the most important this is the META tag, as it overrides the
header settings. This will seems like scandal to purists, but that's the
way it goes. ;-) Here's the header:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	Talk to you soon, Michele.

-- 
Michele Beltrame
http://www.italpro.net/mb/
ICQ# 76660101 - e-mail: mb at italpro.net


More information about the Petal mailing list