# New Ticket Created by Patrick R. Michaud
# Please include the string: [perl #113886]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org:443/rt3/Ticket/Display.html?id=113886 >
On Thu, Jun 28, 2012 at 02:40:40PM +0200, Moritz Lenz wrote:
> Am 28.06.2012 14:31, schrieb Gabor Szabo:
> >The following script generates an exception
> >
> >use v6;
> >
> >my %count;
> >my $s = 'שלום';
> >%count{$s} = 1;
> >say $s;
> >say %count.perl;
> >
> >no ICU lib loaded
> > in method perl at src/gen/CORE.setting:3892
> > in method perl at src/gen/CORE.setting:5921
> > in method perl at src/gen/CORE.setting:6115
> > in block at code/count.pl6:7
> >
> >The crash is in calling .perl on the hash I think, printing the scalar
> >worked.
>
> The difference is that á fits into Latin-1, and there's some support
> for characters in the Latin-1 range hardcoded into parrot/nqp/rakudo
> (dunno which part exactly) which works even in the absence of ICU.
It appears to be Str.perl that is the issue (Hash.perl ends up
calling Str.perl for the keys):
pmichaud@kiwi:~/p6/noicu$ cat x
my $s = 'שלום';
say $s;
say $s.perl;
pmichaud@kiwi:~/p6/noicu$ ./perl6 x
שלום
no ICU lib loaded
in method perl at src/gen/CORE.setting:3892
in block at x:3
Str.perl tries to convert non-printing characters to \x[...]
escapes, and for characters outside of Latin-1 it needs ICU
in order to make that determination.
We could have Str.perl do something more reasonable than
throw the exception if ICU isn't present.
I'm filing a ticket for this to track it (even if we
ultimately decide to leave it as-is for a while).
Pm