From: Nick Ing-Simmons Date: Tue, 9 Jul 2002 12:38:01 +0000 (+0000) Subject: Call $encoding->decode($sv) without a $chk argument. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f989386671918f01ee81e803b0ebff38ff623ad4;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/sv.c b/sv.c index fa629ae..076ea5c 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); } +