[Petal] entity euro hurts
Jean-Michel Hiver
jhiver at mkdoc.com
Mon Apr 26 12:51:12 BST 2004
OK, I have a few insights on your problem.
>- prova.xhtml: doesn't contain any € or € entity, so the ø
>in København appears correctly. is replaced with a blank (why,
>by the way?)
>
It should be replaced by a "Non Breakable SPace" character. This is what
means.
A furiously looks like a space...
>- prova2.xhtml: contains €, which causes every entity to appear
>messed up.
>
The problem is the following:
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.
If you want to be sure that your template is _ALWAYS_ latin1, you have
to use the 'Encode' module as follows:
use Encode;
my $string = $template->process (%stuff);
$string = Encode::encode ('ISO-8859-1', $string);
>- prova3.xhtml: contains €;, which causes every entity to appear
>messed up (except actually for the € itself, which remains as it
>but I just can't see it the browser (console only).
>
I don't know which character you used for prova3.xhtml, but it appears
very broken. I open the file in mozilla and wether I use latin-1 or
UTF-8 to view your example, it doesn't work properly. I suspect this
third template is broken.
>If I use an ø instead of ø for København that is printed just
>fine regardless of what I do with Euro. The problems come when I
>use entities in the &entityname; form. Moreover, never works
>as it should. ;-)
>
Actually it does. It simply replaces it with its corresponding character.
More information about the Petal
mailing list