Re: entity euro hurts

Michele Beltrame <mb-pzZ8rf8/[email protected]>
Newsgroups gmane.comp.lang.perl.modules.petal
Message-ID <[email protected]>
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 &euro; 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 "&euro;". 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 "&euro;" in my template, "&nbsp;"
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 "&euro;" 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-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.