Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add fix for Str.perl to be more robust when ICU isn't present (RT #11…
…3886).
  • Loading branch information
pmichaud committed Jul 2, 2012
1 parent 1edbd37 commit 16db643
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/core/Str.pm
Expand Up @@ -454,13 +454,16 @@ my class Str does Stringy {
multi method gist(Str:D:) { self }
multi method perl(Str:D:) {
my $result = '"';
my $icu = $*VM<config><has_icu>;
for ^self.chars -> $i {
my $ch = self.substr($i, 1);
$result ~= %esc{$ch} // (nqp::iscclass(
pir::const::CCLASS_PRINTING,
nqp::unbox_s($ch), 0)
?? $ch
!! $ch.ord.fmt('\x[%x]'));
$result ~= %esc{$ch}
// ( ((!$icu && $ch.ord >= 256)
|| nqp::iscclass( pir::const::CCLASS_PRINTING,
nqp::unbox_s($ch), 0))
?? $ch
!! $ch.ord.fmt('\x[%x]')
);
}
$result ~ '"'
}
Expand Down

0 comments on commit 16db643

Please sign in to comment.