diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-09 13:50:57 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-09 13:50:57 +0000 |
commit | 52d2e0f43e4c92315f9f6c027571388b7bc65ff5 (patch) | |
tree | 9d3a5ecb667da98fcf89f05c2b945974ed5cf5ed /toke.c | |
parent | 5460b889677b9f352c882dbcd4ad4470b8281664 (diff) | |
download | perl-52d2e0f43e4c92315f9f6c027571388b7bc65ff5.tar.gz |
From Inaba Hiroto: DATA wasn't properly utf8ed
under 'use encoding'.
p4raw-id: //depot/perl@18865
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -4188,8 +4188,29 @@ Perl_yylex(pTHX) } #endif #ifdef PERLIO_LAYERS - if (UTF && !IN_BYTES) - PerlIO_apply_layers(aTHX_ PL_rsfp, NULL, ":utf8"); + if (!IN_BYTES) { + if (UTF) + PerlIO_apply_layers(aTHX_ PL_rsfp, NULL, ":utf8"); + else if (PL_encoding) { + SV *name; + dSP; + ENTER; + SAVETMPS; + PUSHMARK(sp); + EXTEND(SP, 1); + XPUSHs(PL_encoding); + PUTBACK; + call_method("name", G_SCALAR); + SPAGAIN; + name = POPs; + PUTBACK; + PerlIO_apply_layers(aTHX_ PL_rsfp, NULL, + Perl_form(aTHX_ ":encoding(%"SVf")", + name)); + FREETMPS; + LEAVE; + } + } #endif PL_rsfp = Nullfp; } |