summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-02-24 18:44:41 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-02-24 18:44:41 +0000
commitdb79b45b3c913399aef4d2f3647453e63c4772a8 (patch)
tree8f017949a97d258ab9bf69382ed306017ae5d7f4 /sv.c
parent8fde6460a7cb90e344d87e1652b5fa8d61c68699 (diff)
downloadperl-db79b45b3c913399aef4d2f3647453e63c4772a8.tar.gz
Patching magic from Inaba-san's keyboard: fix for [perl #8769]:
"scalar upgraded to UTF-8 as a side effect of quote-interpolation when 'use encoding' is engaged"-- wasn't actually encoding's fault. p4raw-id: //depot/perl@18764
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sv.c b/sv.c
index 73fef98fed..b132a1e6f3 100644
--- a/sv.c
+++ b/sv.c
@@ -8288,7 +8288,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
I32 svix = 0;
static char nullstr[] = "(null)";
SV *argsv = Nullsv;
- bool has_utf8 = FALSE; /* has the result utf8? */
+ bool has_utf8; /* has the result utf8? */
+ bool pat_utf8; /* the pattern is in utf8? */
+ SV *nsv = Nullsv;
+
+ has_utf8 = pat_utf8 = DO_UTF8(sv);
/* no matter what, this is a string now */
(void)SvPV_force(sv, origlen);
@@ -8389,7 +8393,10 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
/* echo everything up to the next format specification */
for (q = p; q < patend && *q != '%'; ++q) ;
if (q > p) {
- sv_catpvn(sv, p, q - p);
+ if (has_utf8 && !pat_utf8)
+ sv_catpvn_utf8_upgrade(sv, p, q - p, nsv);
+ else
+ sv_catpvn(sv, p, q - p);
p = q;
}
if (q++ >= patend)