perl-unicode

Re: Encode::compat (was Re: Encode functionality for Perl 5.6.1)

2002-09-21 21:30:06
On Sun, Sep 22, 2002 at 06:19:21AM +0300, Jarkko Hietaniemi wrote:
If one has the GNU recode installed one can also fall back to
Convert::Recode.

Thus noted.  Thanks!

and if all else fails one can do at least the Latin-1 <-> UTF-8 byte
level conversion rather trivially with the:

    s/([\x80-\xFF])/chr(0xC0|ord($1)>>6).chr(0x80|ord($1)&0x3F)/eg;
    s/([\xC2\xC3])([\x80-\xBF])/chr(ord($1)<<6&0xC0|ord($2)&0x3F)/eg;

Cool algorithmic hack.  I'll add that in, then.  :-)

Thanks,
/Autrijus/

Attachment: pgpRheldlVJZT.pgp
Description: PGP signature