From: Jarkko Hietaniemi Date: Mon, 9 Oct 2000 23:43:16 +0000 (+0000) Subject: Make eq work again with utf8 (disabling the upgrading X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7bbb0251073a77c17bc1102da053cd50c26c0e81;p=p5sagit%2Fp5-mst-13.2.git Make eq work again with utf8 (disabling the upgrading should no more be necessary since the copies of the scalars are upgraded, not the scalars themselves). Takes care of ID 20001009.001. (The claimed length() bug in 20001009.001 seems bogus to me.) p4raw-id: //depot/perl@7182 --- diff --git a/sv.c b/sv.c index a2e6fbd..21b6758 100644 --- a/sv.c +++ b/sv.c @@ -4094,7 +4094,7 @@ Perl_sv_eq(pTHX_ register SV *sv1, register SV *sv2) pv2 = SvPV(sv2, cur2); /* do not utf8ize the comparands as a side-effect */ - if (cur1 && cur2 && SvUTF8(sv1) != SvUTF8(sv2) && !IN_BYTE && 0) { + if (cur1 && cur2 && SvUTF8(sv1) != SvUTF8(sv2) && !IN_BYTE) { if (SvUTF8(sv1)) { pv2 = (char*)bytes_to_utf8((U8*)pv2, &cur2); pv2tmp = TRUE; diff --git a/t/pragma/utf8.t b/t/pragma/utf8.t index 95deee0..fd1abbb 100755 --- a/t/pragma/utf8.t +++ b/t/pragma/utf8.t @@ -10,7 +10,7 @@ BEGIN { } } -print "1..68\n"; +print "1..70\n"; my $test = 1; @@ -20,6 +20,12 @@ sub ok { print "ok $test\n"; } +sub nok { + my ($got,$expect) = @_; + print "# expected not [$expect], got [$got]\nnot " if $got eq $expect; + print "ok $test\n"; +} + sub ok_bytes { use bytes; my ($got,$expect) = @_; @@ -27,6 +33,12 @@ sub ok_bytes { print "ok $test\n"; } +sub nok_bytes { + use bytes; + my ($got,$expect) = @_; + print "# expected not [$expect], got [$got]\nnot " if $got eq $expect; + print "ok $test\n"; +} { use utf8; @@ -310,3 +322,10 @@ sub ok_bytes { ok "@a", "1234 2345"; $test++; # 68 } +{ + my($a,$b); + { use bytes; $a = "\xc3\xa4"; } + { use utf8; $b = "\xe4"; } + { use bytes; ok_bytes $a, $b; $test++; } # 69 + { use utf8; nok $a, $b; $test++; } # 70 +}