[Petal] entity euro hurts

Michele Beltrame mb at italpro.net
Mon Apr 26 14:46:08 BST 2004


Hi Jean!

> In MKDoc/XML/Decode/XHTML.pm, euro points to the decimal value 8364. 
> Since this is a unicode high value, Perl has to upgrade all your strings 
> to unicode. Hence, whenever you use € symbol the resulting string 
> will be UTF-8 rather than latin1.

Just a final question. As said, I now output UTF8 to the browser (setting
the appropriate charset in the HTTP header and meta tag). This however
works until the string (parsed template) I send is really UTF8, that
it to say when I include something that produces an Unicode high value, such
as "€". If I don't do this, Perl doesn't convert its strings to UTF8
and they remain latin1.

This behavious causes the browser (I use Mozilla Firefox under Linux/GTK) to
work just fine if the string is really Unicode, but not that good if
it's not. So, if I don't include an "€" in my template, " "
charachters are shown as a square with FFDD inside (which means that
Mozilla does not own a proper char to display).

So I guess I should force Perl to use UTF8 strings in any case to ensure
a correct output. But, how do I do that? I tried "use encoding 'utf8'" with
no luck. I don't want to embed an "€" with the same colour of the
background in all the templates where I don't need an Euro sign. ;-)

BTW, I use Perl 5.8.3.

	Thanks, Michele.

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


More information about the Petal mailing list