perl-unicode

Re: Unicode aware module

1999-06-12 12:03:11
On Sat, Jun 12, 1999 at 06:30:09AM -0700, Gurusamy Sarathy wrote:
It is simple.  If you have no global utf8 switch, you do not have utf8
capability in Perl.  Without it we finish with what we have now for
locale: you need 4 variants of every module:

    one for no locale no utf
    one for no locale utf
    one for locale no utf
    one for locale utf

(well, maybe 3, since the interaction of locales and utf is not clear).

I think you have a point about how _all_ modules would need
to have the chant C<use caller 'encoding'> to have a useful
utf8 application.

It seems better to have both C<use utf8> and C<use locale> have
a global effect, and add a lexically scoped C<use byte> (or
similar) that will mark places that operate on binary data,
and therefore turn off any encoding related pragmata.  What
do you think?

Thanks.  This is what I'm advocating (for locales) the last two years,
and what I realized about utf8 a couple of weeks ago (but did not
collect enough strength to start Yet Another Fruitless Compain yet).

The only addition: being locale-sensitive and UTF-8 encoded is a
property of *data*, not of a Perl script.  An attempt to handle them by
marking sections of code may be noble, but looks like a lost cause.

We *could* find two extra bits in SvFLAGS to mark these property - if
we decide that instead of 'use byte' we do

   open FOO, 'foo';
   binmode FOO, 'byte';

or

   my $foo : bytes;

Ilya

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