perl-unicode

Re: Unicode aware module

1999-04-23 17:32:48
On Fri, Apr 23, 1999 at 04:54:27PM -0700, Dick Hardt wrote:
At 04:42 PM 4/23/99 , Tim Bunce wrote:
[..]
Whether an _individual_ argument string contains utf8, utf16, ascii or
a gif has nothing to do with the lexical context of the sub that called
you.

The context of the caller is a very unreliable hint at best.

As I see utf8 being used, a programmer would be setting the context and
that _all_ strings would be in UTF8 and anything returned would also be in
UTF8.

For example, I foresee developers on Windows platforms that are dealing
with characters not mapped in Latin1 to have a C<use utf8;> at the top of
all of their scripts, and expect that all strings passed to/from the OS
would also be in UTF8.

That may well be the common case. But it can't be assumed.

Even if it could be assumed, using the immediate callers context would
still not be reliable:

  A.pm: package A; use B; use utf8; B::b("...a utf8 string...");
  B.pm: package B; use C;           sub b { C::c(@_) }
  C.pm: package C;                  sub c { substr($_[0], 1, 1) }

Tim.

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