perl-unicode

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

2002-08-05 14:30:05
I'm trying to backport ExtUtils::Constant from 5.8.0 to work on perl pre
5.8.0. Currently ExtUtils::Constant is using utf8::encode and utf8::decode
to convert Unicode strings to and from their internal byte representation
for testing purposes.

For 5.005_03 I don't have a problem - I just skip all the Unicode tests! :-)
However, for 5.6.1 (and 5.6.0) I do. I can't work out how to (legally!) get
perl to give me the utf8 bytes that represent the Unicode strings, or how
to translate a sequence of utf8 bytes back into a perl Unicode string.

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.

[OK, so I can convert from Unicode to utf8 bytes by using the Unicode string
as a hash key, and exploiting the fact that 5.6.x can't do Unicode hash keys,
but I don't think that playing to the deficiencies of 5.6.x is the right way
to do this. Also, I don't know any 5.6.x bugs that let me translate the other
way]

Nicholas Clark
-- 
Even better than the real thing:        http://nms-cgi.sourceforge.net/

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