summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-03-20 00:55:54 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-20 00:55:54 +0000
commitb310b0538cc1a7948587a9e5ff30683fec2a3ece (patch)
treef3f8fa0dd8ad9ba1aecae60fa5a8079b3fb69237 /perl.c
parent563aca73f1f51dd4b10089896b544a6ae41316cb (diff)
downloadperl-b310b0538cc1a7948587a9e5ff30683fec2a3ece.tar.gz
If it looks like UTF-8 (either nl_langinfo or locale variables),
think UTF-8, embrace your inner UTF-8, as suggested by Larry. (And as suggested by Markus Kuhn.) While we are at it, document also the case of mixed hash keys as a known potential troublemaker. (Since it's locale-related, sometimes.) p4raw-id: //depot/perl@15350
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index ebf5ca121d..c8a63709b0 100644
--- a/perl.c
+++ b/perl.c
@@ -1428,6 +1428,22 @@ print \" \\@INC:\\n @INC\\n\";");
if (!PL_do_undump)
init_postdump_symbols(argc,argv,env);
+ if (PL_wantutf8) { /* Requires init_predump_symbols(). */
+ IO* io;
+ PerlIO* fp;
+ SV* sv;
+ if (PL_stdingv && (io = GvIO(PL_stdingv)) && (fp = IoIFP(io)))
+ PerlIO_binmode(aTHX_ fp, IoTYPE(io), 0, ":utf8");
+ if (PL_defoutgv && (io = GvIO(PL_defoutgv)) && (fp = IoOFP(io)))
+ PerlIO_binmode(aTHX_ fp, IoTYPE(io), 0, ":utf8");
+ if (PL_stderrgv && (io = GvIO(PL_stderrgv)) && (fp = IoOFP(io)))
+ PerlIO_binmode(aTHX_ fp, IoTYPE(io), 0, ":utf8");
+ if ((sv = GvSV(gv_fetchpv("\017PEN", TRUE, SVt_PV)))) {
+ sv_setpvn(sv, ":utf8\0:utf8", 11);
+ SvSETMAGIC(sv);
+ }
+ }
+
init_lexer();
/* now parse the script */