From: Jarkko Hietaniemi Date: Wed, 11 Oct 2000 03:16:05 +0000 (+0000) Subject: SvPV() (via mg_get() of sv_2pv()) can update the UTF8ness of the SVs. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b7018214460794b1717c970bae422221c10f4634;p=p5sagit%2Fp5-mst-13.2.git SvPV() (via mg_get() of sv_2pv()) can update the UTF8ness of the SVs. p4raw-id: //depot/perl@7201 --- diff --git a/pp_hot.c b/pp_hot.c index 400350d..4ddb12c 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -167,13 +167,15 @@ PP(pp_concat) U8 *l, *c, *olds = NULL; STRLEN targlen; s = (U8*)SvPV(right,len); + right_utf |= DO_UTF8(right); if (TARG == right) { /* Take a copy since we're about to overwrite TARG */ - olds = s = (U8*)savepvn((char*)s, len); + olds = s = (U8*)savepvn((char*)s, len); } if (!SvOK(left) && SvTYPE(left) <= SVt_PVMG) sv_setpv(left, ""); /* Suppress warning. */ l = (U8*)SvPV(left, targlen); + left_utf |= DO_UTF8(left); if (TARG != left) sv_setpvn(TARG, (char*)l, targlen); if (!left_utf) diff --git a/t/pragma/utf8.t b/t/pragma/utf8.t index 1b6ca91..2b208cc 100755 --- a/t/pragma/utf8.t +++ b/t/pragma/utf8.t @@ -10,7 +10,7 @@ BEGIN { } } -print "1..72\n"; +print "1..75\n"; my $test = 1; @@ -344,3 +344,33 @@ sub nok_bytes { $latin =~ s!(s)tr(?:aß|s+e)!$1tr.!; # \303\237 after the a } } + +{ + $_ = $dx = "\x{10f2}"; + s/($dx)/$dx$1/; + { + use bytes; + print "not " unless $_ eq "$dx$dx"; + print "ok $test\n"; + $test++; + } + + $_ = $dx = "\x{10f2}"; + s/($dx)/$1$dx/; + { + use bytes; + print "not " unless $_ eq "$dx$dx"; + print "ok $test\n"; + $test++; + } + + $dx = "\x{10f2}"; + $_ = "\x{10f2}\x{10f2}"; + s/($dx)($dx)/$1$2/; + { + use bytes; + print "not " unless $_ eq "$dx$dx"; + print "ok $test\n"; + $test++; + } +}