under 'use encoding'.
p4raw-id: //depot/perl@18865
ext/Encode/t/CJKT.t test script
ext/Encode/t/Encode.t test script
ext/Encode/t/Encoder.t test script
+ext/Encode/t/enc_data.t test script for utf8 DATA
ext/Encode/t/enc_eucjp.t test script
ext/Encode/t/enc_module.enc test data for t/enc_module.t
ext/Encode/t/enc_module.t test script
t/big5-eten.utf test data
t/big5-hkscs.enc test data
t/big5-hkscs.utf test data
+t/enc_data.t test script for utf8 DATA
t/enc_eucjp.t test script
t/enc_module.enc test data for t/enc_module.t
t/enc_module.t test script
--- /dev/null
+use encoding 'euc-jp';
+use Test::More tests => 1;
+
+my @a;
+
+while (<DATA>) {
+ chomp;
+ tr/¤¡-¤ó¥¡-¥ó/¥¡-¥ó¤¡-¤ó/;
+ push @a, $_;
+}
+
+SKIP: {
+ skip("pre-5.8.1 does not do utf8 DATA", 1) if $] < 5.008001;
+ ok(@a == 3 &&
+ $a[0] eq "¥³¥ì¥ÏDATA¤Õ¤¡¤¤¤ë¤Ï¤ó¤É¤ë¥Î¤Æ¤¹¤È¥Ç¥¹¡£" &&
+ $a[1] eq "ÆüËܸ쥬¥Á¥ã¥ó¥ÈÊÑ´¹¥Ç¥¥ë¥«" &&
+ $a[2] eq "¥É¥¦¥«¥Î¤Æ¤¹¤È¥ò¥·¥Æ¥¤¥Þ¥¹¡£",
+ "utf8 (euc-jp) DATA")
+}
+
+__DATA__
+¤³¤ì¤ÏDATA¥Õ¥¡¥¤¥ë¥Ï¥ó¥É¥ë¤Î¥Æ¥¹¥È¤Ç¤¹¡£
+ÆüËܸ줬¤Á¤ã¤ó¤ÈÊÑ´¹¤Ç¤¤ë¤«
+¤É¤¦¤«¤Î¥Æ¥¹¥È¤ò¤·¤Æ¤¤¤Þ¤¹¡£
}
#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;
}