On Thu, Feb 17, 2005 at 09:24:53PM -0000, dgeorge @ cas. org wrote: > use strict; > use bytes; > use XML::DOM; > > # XML document > my $xml = "<doc>\xe2\x80\x98WOW\xe2\x80\x99</doc>"; > > # XML parser > my $parser = new XML::DOM::Parser; > > # Document Object Model > my $dom = $parser->parse($xml, ProtocolEncoding => 'UTF-8'); > > # Element content > my $content = $dom->getDocumentElement()->getFirstChild()->getNodeValue(); > > # Print length of $content(should be 9 and is 9) > print 'Length of $content = ', unpack("H*", $content), ' is ', > length($content), "\n"; > > # Print length of $1(should be 3 1 1 1 3 and is 1 1 1 1 3) > $content =~ > s/([\x00-\x7f]|[\xc0-\xdf].|[\xe0-\xef]..|[\xf0-\xf7]...|[\xf8-\xfb]....|[\xfc-\xfd].....)/print > 'Length of $1 = ', unpack("H*", $1), ' is ', length($1), "\n"/eg;
Fixed in bleedperl by the change below -- In my day, we used to edit the inodes by hand. With magnets. Change 25088 by [EMAIL PROTECTED] on 2005/07/07 00:11:00 [perl #34171] bytes pragma error in substitution operator Affected files ... ... //depot/perl/pp_ctl.c#464 edit ... //depot/perl/t/op/subst.t#43 edit Differences ... ==== //depot/perl/pp_ctl.c#464 (text) ==== @@ -204,7 +204,7 @@ } rxres_restore(&cx->sb_rxres, rx); - RX_MATCH_UTF8_set(rx, SvUTF8(cx->sb_targ)); + RX_MATCH_UTF8_set(rx, DO_UTF8(cx->sb_targ)); if (cx->sb_iters++) { const I32 saviters = cx->sb_iters; ==== //depot/perl/t/op/subst.t#43 (xtext) ==== @@ -7,7 +7,7 @@ } require './test.pl'; -plan( tests => 130 ); +plan( tests => 131 ); $x = 'foo'; $_ = "x"; @@ -539,3 +539,17 @@ $name =~ s/hr//e; } is($name, "cis", q[#22351 bug with 'e' substitution modifier]); + + +# [perl #34171] $1 didn't honour 'use bytes' in s//e +{ + my $s="\x{100}"; + my $x; + { + use bytes; + $s=~ s/(..)/$x=$1/e + } + is(length($x), 2, '[perl #34171]'); +} + +