perl-unicode

Re: how to utf8::encode and ::decode in 5.6.1

2002-08-05 15:30:13
On Mon, Aug 05, 2002 at 10:17:10PM +0100, Nicholas Clark wrote:
So how should I write utf8::encode and utf8::decode for 5.6.1 and 5.6.0?
I can cope if a different solution is needed on both.

I made a quick XS hack that exposes those functions in 5.6.1 as well
(basically copied from the 5.8.0 sources). I called the module "UTF8".
Blegh.

Hmm. Seems I only did utf8::decode actually. the XS looks like this:

    MODULE = UTF8           PACKAGE = utf8          PREFIX = sv_utf8_

    bool
    sv_utf8_decode(sv)
        SV *sv

You can't get much shorter than that :-)

In the UTF8.pm file I made the call to bootstrap conditional on the perl
version, so 5.7 and greater just use the builtin function.

I won't make this into a CPAN module, as I plan to just switch to 5.8.0
as soon as possible.

-- 
Bart.

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