diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-07-09 12:38:01 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-07-09 12:38:01 +0000 |
commit | f989386671918f01ee81e803b0ebff38ff623ad4 (patch) | |
tree | 084fc41801bae62111e504ccd72d97a4f2178799 /sv.c | |
parent | 1fd8f4ce4f455e94926dba744af1f828c467ad44 (diff) | |
download | perl-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.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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); } + |