Re: Creating a UTF-8 web page
[email protected] (Eric Cholet)
| Newsgroups | perl.unicode |
|---|---|
| Message-ID | <[email protected]> |
Le 8 avr. 04, à 07:38, Octavian Rasnita a écrit :
> Ok, thank you for your help, but I guess in this case my problem is
> that I
> don't know how to print the UTF8 string.
> I want to get a latin2 text and print it as UTF-8 and I hope this is
> not too
> complicated. Please help.
> For example I want to print a text like:
>
> print "mâta";
The way I do this is to convert all input to Perl's internal unicode:
use Encode;
my $s = Encode::decode('latin2', 'mâta');
$s is now a Unicode string with all the nice unicode semantics.
Then when ready to output I convert to the desired encoding :
print Encode::encode('utf8', $s);
--
Eric Cholet