summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-08-16 11:46:02 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-08-16 11:46:02 +0000
commit6ee35fb7e604a038209f7db33f1e4817a38d5c05 (patch)
tree8a1139763985e4badf445b53b49eca765abc8672
parent32c0e916b39148c319a03b9479ed34c7582453f3 (diff)
downloadperl-6ee35fb7e604a038209f7db33f1e4817a38d5c05.tar.gz
Fix for 20010407.008 sprintf removes utf8-ness.
p4raw-id: //depot/perl@11691
-rw-r--r--pp.c2
-rwxr-xr-xt/op/misc.t11
2 files changed, 10 insertions, 3 deletions
diff --git a/pp.c b/pp.c
index ee9d47e90f..c0148b36a1 100644
--- a/pp.c
+++ b/pp.c
@@ -2933,6 +2933,8 @@ PP(pp_sprintf)
dSP; dMARK; dORIGMARK; dTARGET;
do_sprintf(TARG, SP-MARK, MARK+1);
TAINT_IF(SvTAINTED(TARG));
+ if (DO_UTF8(*(MARK+1)))
+ SvUTF8_on(TARG);
SP = ORIGMARK;
PUSHTARG;
RETURN;
diff --git a/t/op/misc.t b/t/op/misc.t
index e7f1623a28..e55e18a0a2 100755
--- a/t/op/misc.t
+++ b/t/op/misc.t
@@ -724,9 +724,14 @@ sub DESTROY {
EXPECT
Bar=ARRAY(0x...)
########
-printf "%x %x", unpack "U*", sprintf "\x{1234}%s", "\x{5678}"
-EXPECT
-1234 5678
+# 20010407.008 sprintf removes utf8-ness
+$a = sprintf "\x{1234}";
+printf "%x %d\n", unpack("U*", $a), length($a);
+$a = sprintf "\x{1234}%s", "\x{5678}";
+printf "%x %x %d\n", unpack("U*", $a), length($a);
+EXPECT
+1234 1
+1234 5678 2
########
# keep this last - doesn't seem to work otherwise?
eval "a.b.c.d.e.f;sub"