perl-unicode

Re: [Perl Unicode] converting SJIS to UTF-8

2001-01-07 10:20:16
On Wed Jan  3 18:31:47 2001 -0800 Chris Mealy wrote:



Based on the perl unicode faq, I expected this to work:

sub shift_jis_to_utf8 {
    my ($shift_jis) = @_;

    my $encoding = 'Shift-JIS';
    my $Map = new Unicode::Map({ ID => $encoding });
    my $map_out = $Map->to_unicode($shift_jis);
    my $us = Unicode::String->new($map_out);
    my $us_utf8 = $us->utf8;

    return $us_utf8;
}

but it doesn't.  What's the right way to convert SJIS to UTF-8 with perl?


        Text::Iconv ?
-- 
      ☻ Ričardas Čepas ☺
~~
~

<Prev in Thread] Current Thread [Next in Thread>