perl-unicode

Re: [EXPERIMENTAL] 1st draft of Encode

2000-09-11 16:13:50
I would like to see these convert perl strings to bytes:

  to_utf8

And these convert a sequence of bytes to perl strings:

  from_utf8

You seem to want to define these function the opposite way.  Perhaps
the names are just too confusing.

Even on second reading I do not follow your naming logic.  Sorry, I
must be slow today.

First of all, what do you mean by "sequence of bytes"?  As opposed
to "perl strings"?  That difference makes little sense at Perl level,
where the user only has "perl strings".

My proposed interface was

    $utf8  = to_utf8($string);
    $bytes = from_utf8($utf8);

meaning that either we have a "perl string" that we know not to be
utf8, and we want to know it is 'in utf8', as a "perl string" , or
that what we have what we know to be utf8, and we want to know
the 'raw', de-utf8'ed data, as a "perl string".

If I say 'to_XXX', I expect the source not to be already 'in XXX'
(or if it is, the to_XXX should be a null op).  Vice versa for 'from_XXX'.

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen