develooper Front page | perl.perl5.porters | Postings from June 2002

Another Unicode s/// buglet?

Thread Next
From:
SADAHIRO Tomoyuki
Date:
June 26, 2002 07:10
Subject:
Another Unicode s/// buglet?
Message ID:
20020626230031.163A.BQW10602@nifty.com

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


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About