perl-unicode

2 Suprises w/5.8.0

2002-07-31 19:30:05
Greetings,

I've finally installed 5.8.0 and started putting it to
good use but hit two surprises.  Hopefully I've just
overlooked something in the perlunicode and perluniintro
man pages and these aren't actual bugs.


I expected that I could work simply with

  -------------
  # myScript.pl

  use MyModule qw(myFunction);

  my $myString = <utf8-data>;
  print myFunction ( $myString ), "\n";
  -------------

and have all go smoothly.  Unfortunately 'split' in myFunction
was breaking up bytes and not recognizing utf8 chars.

After a bit of trial and error I got around the problem with

  -------------
  # myScript.pl

  use utf8;
  use MyModule qw(myFunction);

  print myFunction ( ... ), "\n";
  -------------

and modifying MyModule:

  -------------
  package MyModule;
  use utf8;

  BEGIN { #use utf8; didn't work here! };
  -------------

Only this combination got 'split' in myFunction to chop up utf-8
text properly.  Is this behavior expected?


Another issue I've encountered was with using Unicode::String
under Perl 5.8 -should we no longer be using this package?
The UTF-8 chars the package generates are not recognized
as such, 'length()' for instance reports incorrectly.  Can
we somehow bless strings as UTF-8?  This would be useful
for working with older packages.

thanks,

/Daniel

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