Re: More on entitie s and Â

Michele Beltrame <mb-pzZ8rf8/[email protected]>
Newsgroups gmane.comp.lang.perl.modules.petal
Message-ID <[email protected]>
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-pzZ8rf8/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.