Re: entity euro hurts

Mark Holland <mark-rHpctHB9Aj9Wk0Htik3J/[email protected]>
Newsgroups gmane.comp.lang.perl.modules.petal
Message-ID <[email protected]>
Michele Beltrame wrote:

>>I am using 2.05 I have got &nbsp; to work by using 
>>	input        => 'HTML',
>>	output       => 'HTML',
>>but if I use &euro; or &#8364; it turns to  Â, while &euro; turns to
>>â???¬.
>>    
>>
>
>I have the same problem, that's why I have to avoid using "&euro;" for
>now. :-(
>
>I'm just using output => 'XHTML' and leave the rest as per default.
>"&nbsp;" works until I insert an "&euro;", 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
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.