perl-unicode

Another Unicode s/// buglet?

2002-06-26 07:30:05

Hello.

With Perl 5.8.0 RC2 (or plus Change 17353),
there is something strange.

In $unicode =~ s/$regex/$bytes/,
$bytes is not upgraded,
and a malformed Unicode string is generated.

$unicode =~ s/$regex/$bytes/e is ok, though.

E.g.,

#!perl

    $a = "\x{100}\x{101}";
    $a =~ s/\x{101}/\xFF/;
    print $a =~ /\xFF/ ? "ok" : "not ok", " \n";
    print length($a) == 2 ? "ok" : "not ok", " \n";

    $a = "\x{100}\x{101}";
    $a =~ s/\x{101}/"\xFF"/e;
    print $a =~ /\xFF/ ? "ok" : "not ok", " \n";
    print length($a) == 2 ? "ok" : "not ok", " \n";

__END__

Result:

not ok
Malformed UTF-8 character (unexpected end of string) at bleedperl.pl
not ok
ok
ok

Regards,
SADAHIRO Tomoyuki

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