perl-unicode

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

2002-09-21 21:30:06
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.  :-)

Someone has not been reading perluniintro.... :-)

-- 
Jarkko Hietaniemi <jhi(_at_)iki(_dot_)fi> http://www.iki.fi/jhi/ "There is this 
special
biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen