| Author |
How to convert latin1 to utf8
|
|
| francescomoi@europe.com 2005-02-25, 3:59 pm |
| Hi.
I've got some texts in Latin1 and like to convert to UTF-8.
Is this possible with 'Unicode::String'???
Thank you very much.
| |
| Robert Sedlacek 2005-02-25, 3:59 pm |
| francescomoi wrote:
> Is this possible with 'Unicode::String'???
The Docs seem so, but I think I would C<use Encode;>.
--
http://www.dunkelheit.at/
...and in darkness bind them.
| |
| Villy Kruse 2005-02-28, 8:57 am |
| On 25 Feb 2005 07:53:47 -0800,
francescomoi@europe.com <francescomoi@europe.com> wrote:
> Hi.
>
> I've got some texts in Latin1 and like to convert to UTF-8.
>
> Is this possible with 'Unicode::String'???
>
In combination with Unicode::Map it works on version 5.005
use Unicode::Map();
use Unicode::String qw(utf8 utf16);
my $CHARSET = 'ISO-8859-1';
my $Map = new Unicode::Map($CHARSET);
sub latin_to_utf8 { utf16($Map->to16($_[0]))->utf8; }
sub utf8_to_latin { $Map->to8(utf8($_[0])->utf16); }
Villy
|
|
|
|