[Petal] Recap on utf8 encoding issues and PerlIO patch

Bruno Postle bruno at mkdoc.com
Thu Jan 20 17:59:30 GMT 2005


On Thu 20-Jan-2005 at 11:58 -0500, William McKee wrote:

> (after eliminating the issue of the browser trying to display utf8
> as Western ISO-8859-1)

We have discovered that browsers sometimes do this even when
presented with all the right hints.  We currently put this in Petal
templates so it appears as utf-8 in the first few bytes of HTML
output:

   <meta name="generator" content="MKDoc &#12434; 1.6, see http://www.mkdoc.org/" />

..it seems to persuade some browsers to intrepret the document
properly.

> I found a bug at line 177 of Petal.pm

> And here's what Petal is currently doing:
> 
>   open FP, "<:$encoding", "$file_path" || die 'Cannot read-open $file_path';

> Changing it to:
> 
>   open FP, "<:encoding($encoding)", "$file_path" or die "Cannot read-open $file_path";

..and this explains why this line works if $encoding is utf8, since
"<:utf8" happens to be valid syntax.

-- 
Bruno


More information about the Petal mailing list