[Petal] entity euro hurts

Mark Holland mark at thinkfoo.com
Mon Apr 19 00:41:08 BST 2004


Michele Beltrame wrote:

>>I am using 2.05 I have got   to work by using 
>>	input        => 'HTML',
>>	output       => 'HTML',
>>but if I use € or € it turns to  Â, while € turns to
>>â???¬.
>>    
>>
>
>I have the same problem, that's why I have to avoid using "€" for
>now. :-(
>
>I'm just using output => 'XHTML' and leave the rest as per default.
>" " works until I insert an "€", after which no entity
>seems to work anymore until I remove it.
>  
>
Try making sure all your output is unicode and that your browser is 
aware of this by setting your http content-type header to:

Content-type: text/html; charset=utf-8

and adding the following meta tag to your html (as some browsers don't 
honour/recognise the charset portion of the content-type header)

<meta http-equiv="content-type" content="text/html" charset=utf-8"/>

 I tried the &euro; entity on my system with this set up and it produces 
the character with no problems.

Note: What confused me about entities earlier was that my application 
was producing some ouput in latin-1 whilst the petal parts were 
producing utf-8. I just made sure that all the output I produced outside 
of petal was encoded to utf8, using

use Encode;
my $output = "Some string encoded in latin-1";
my $utf8string = encode("utf-8", $output);

Hope this helps,
~mark


More information about the Petal mailing list