- or download this
while(my $uchar = $us->chop) {
my $utf8 = $uchar->utf8;
$rslt = (($utf8 =~ /[\x80-\xff]/) ? '\\u'.unpack('H4', $uchar-
+>utf16be) : $utf8) . $rslt;
}
- or download this
while(my $uchar = $us->substr( $offset++, 1 )) {
my $utf8 = $uchar->utf8;
$rslt .= ($utf8 =~ /[\x80-\xff]/) ? '\\u'.unpack('H4', $uchar-
+>utf16be) : $utf8;
}
- or download this
# This does what Unicode::Escape::escape does, except a lot less.
# It assumes the input is utf8 encoded.
...
return $s;
}
- or download this
use strict;
use warnings;
...
# puke a lot of unintelligible yuck.
ok( $canonical eq $test, "correct escaping for '$t->{name}'" );
}
- or download this
use strict;
use warnings;
...
print "*** $txt->[1]\n";
cmpthese( -30, $subs );
}
- or download this
sub utf8_escape_2 {
my $s = shift;
...
return $s;
}