From: Jarkko Hietaniemi Date: Sat, 12 Jan 2002 05:11:20 +0000 (+0000) Subject: Andreas is busy :-) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5b781b5bd88f1a6304dcbbe8f741a84af480cee7;p=p5sagit%2Fp5-mst-13.2.git Andreas is busy :-) p4raw-id: //depot/perl@14206 --- diff --git a/doop.c b/doop.c index 0c7abf4..8b02034 100644 --- a/doop.c +++ b/doop.c @@ -697,6 +697,7 @@ Perl_do_sprintf(pTHX_ SV *sv, I32 len, SV **sarg) char *pat = SvPV(*sarg, patlen); bool do_taint = FALSE; + SvUTF8_off(sv); if (DO_UTF8(*sarg)) SvUTF8_on(sv); sv_vsetpvfn(sv, pat, patlen, Null(va_list*), sarg + 1, len - 1, &do_taint); diff --git a/t/op/unisprintf.t b/t/op/unisprintf.t index 5c9bbb0..3c5f574 100644 --- a/t/op/unisprintf.t +++ b/t/op/unisprintf.t @@ -6,7 +6,7 @@ BEGIN { require "test.pl"; } -plan tests => 23; +plan tests => 25; $a = "B\x{fc}f"; $b = "G\x{100}r"; @@ -124,3 +124,16 @@ $c = 0x200; is((sprintf "%x %x %d", unpack("U*", $a), length($a)), "1234 5678 2", '\x{1234}%s \x{5678}'); } + +{ + # check that utf8ness doesn't "accumulate" + + my $w = "w\x{fc}"; + my $sprintf; + + $sprintf = sprintf "%s%s", $w, "$w\x{100}"; + is(substr($sprintf,0,2), $w, "utf8 echo"); + + $sprintf = sprintf "%s%s", $w, "$w\x{100}"; + is(substr($sprintf,0,2), $w, "utf8 echo echo"); +}