summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorAndreas König <a.koenig@mind.de>2002-04-22 14:08:48 +0200
committerJarkko Hietaniemi <jhi@iki.fi>2002-04-24 02:03:08 +0000
commit89afcb60a8aa0fcded9f2490166a9f2c4cb540f8 (patch)
tree74d57c1632f7620552793c1b9ef3d677b48e16b0 /pp_hot.c
parentdd2bab0fb2e17ae44696734bb227a5e113986f34 (diff)
downloadperl-89afcb60a8aa0fcded9f2490166a9f2c4cb540f8.tar.gz
New UTF-8 surprise
Message-ID: <m38z7gjb9r.fsf@anima.de> p4raw-id: //depot/perl@16124
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 492b50be17..027d1249ac 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2117,7 +2117,14 @@ PP(pp_subst)
break;
} while (CALLREGEXEC(aTHX_ rx, s, strend, orig, s == m,
TARG, NULL, r_flags));
- sv_catpvn(dstr, s, strend - s);
+ if (doutf8 && !DO_UTF8(dstr)) {
+ SV* nsv = sv_2mortal(newSVpvn(s, strend - s));
+
+ sv_utf8_upgrade(nsv);
+ sv_catpvn(dstr, SvPVX(nsv), SvCUR(nsv));
+ }
+ else
+ sv_catpvn(dstr, s, strend - s);
(void)SvOOK_off(TARG);
Safefree(SvPVX(TARG));