[Petal] UTF8 under Perl 5.6.1

Grant McLean grant at mclean.net.nz
Sat Feb 26 19:14:06 GMT 2005


On Sat, 2005-02-26 at 07:58 -0500, William McKee wrote:
> 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?

The UTF8 implementation in 5.6 is not great, but it certainly does work
for simple cases like the one you quote.

The recommended approach is to include a meta-equiv tag in your HTML
head:

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

and also set the content type HTTP header:

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

If you don't specify the charset in the HTTP, Apache typically sets it
to 'iso-8859-1'.  I think there's an RFC somewhere that says the HTTP
header trumps the meta tag.

Regards
Grant



More information about the Petal mailing list