[Petal] Weird behaviour of encoded entities

Jean-Michel Hiver jhiver at mkdoc.com
Thu Nov 27 14:29:00 GMT 2003


> I've been dabbling with Petal a bit and like it, but there seems to be
> some confusion (on my side) with how entities within templates are handled.
> 
> < remains encoded
> &gt; gets turned into "<"

No, &gt; gets turned into ">".

It is actually well-formed XML and it is necessary to leave '>' as '>'
rather than &gt; because the CSS style selectors use the '>' character,
not '&gt;'


> &nbsp; gets turned into &amp;nbsp;

Unless you have $Petal::INPUT = 'HTML' somewhere in your code or you 
construct your Petal object as follows:

    my $template = Petal>new(
      file     => gerbils.html,
      base_dir => /var/www/petshop,
      input    => HTML,
      output   => HTML,
    );

cf. perldoc Petal.

That being said I think I've spotted unicode trouble with these kind of
entities (trying including a file which contains &pound;) which I need to
address.


> &amp; remains encoded
> 
> Maybe it is something with my template, that I should have another
> namespace or some <? > declaration there, but it confuses me to no end :-)

See above :)


> I haven't looked where the problem comes from programmatically, as I
> think that the problem is more with my usage than with Petal itself :-)

Actually unfortunately Petal 2 is not yet as bug-free as it's 1.06 ancestor due
to a major backend change. But it'll get there eventually :)

Cheers,
-- 
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver at mkdoc.com  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/


More information about the Petal mailing list