summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2002-07-09 12:38:01 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2002-07-09 12:38:01 +0000
commitf989386671918f01ee81e803b0ebff38ff623ad4 (patch)
tree084fc41801bae62111e504ccd72d97a4f2178799 /sv.c
parent1fd8f4ce4f455e94926dba744af1f828c467ad44 (diff)
downloadperl-f989386671918f01ee81e803b0ebff38ff623ad4.tar.gz
Call $encoding->decode($sv) without a $chk argument.
This fixes modification of readonly value under use encoding(). Not a final fix as it does not warn on failed decode. p4raw-id: //depot/perlio@17435
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sv.c b/sv.c
index fa629aec8f..076ea5c896 100644
--- a/sv.c
+++ b/sv.c
@@ -10516,7 +10516,7 @@ The PV of the sv is returned.
char *
Perl_sv_recode_to_utf8(pTHX_ SV *sv, SV *encoding)
{
- if (SvPOK(sv) && !DO_UTF8(sv) && SvROK(encoding)) {
+ if (SvPOK(sv) && !DO_UTF8(sv) && SvROK(encoding)) {
SV *uni;
STRLEN len;
char *s;
@@ -10527,7 +10527,16 @@ Perl_sv_recode_to_utf8(pTHX_ SV *sv, SV *encoding)
EXTEND(SP, 3);
XPUSHs(encoding);
XPUSHs(sv);
+/*
+ NI-S 2002/07/09
+ Passing sv_yes is wrong - it needs to be or'ed set of constants
+ for Encode::XS, while UTf-8 decode (currently) assumes a true value means
+ remove converted chars from source.
+
+ Both will default the value - let them.
+
XPUSHs(&PL_sv_yes);
+*/
PUTBACK;
call_method("decode", G_SCALAR);
SPAGAIN;
@@ -10543,8 +10552,9 @@ Perl_sv_recode_to_utf8(pTHX_ SV *sv, SV *encoding)
FREETMPS;
LEAVE;
SvUTF8_on(sv);
- }
- return SvPVX(sv);
+ }
+ return SvPVX(sv);
}
+