perl-unicode

Encode::compat 0.01 says "Unsupported conversion"

2002-09-23 03:30:05
Hi,

unlike stated in my previous 2 postings from the previous thread, I finally
commented everything within

if ($] >= 5.007001 or $INC{'Encode.pm'}) {
    # nothing happens -- Encode.pm already available.
    $INC{'Encode.pm'} = __FILE__;
    require Encode::compat::common;
    require Encode::compat::5006001;
}

from Autrijus' Encode::compat 0.01 file 'lib/Encode/compat.pm' out.
Otherwise, using it with perl 5.8.0 would also require the
(non-standard) Text::Iconv module.

I have tested it with the following CGI code that should print the "ä"
character UTF-8 encoded and the byte numbers that represent it (C3 and
A4):

        use Encode::compat;
        use Encode;
        my $string = "ä";
        Encode::from_to($string, "iso-8859-1", "utf8");
        my $ord_hex = join("\n", map(uc(sprintf "%lx", 
ord($_)),split(//,$string)));
        print "Content-Type: text/html\n\n";
        print "<meta http-equiv=\"Content-Type\" content=\"text/html; 
charset=utf-8\" /><pre>";
        print "'$string' (", length($string), " bytes):\n$ord_hex";

It works fine with Perl 5.8, but with 5.6.1 the following error
occurs:

Unsupported conversion: Invalid argument at (...) 
/perl/lib/Encode/compat/common.pm line 87.

Autrijus, could you please give a working example or a suggestion on
how to get Encode::compat to work?

Thanks,
rob.

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