From: Jarkko Hietaniemi Date: Mon, 10 Jun 2002 13:44:49 +0000 (+0000) Subject: NI-S doesn't need these comments :-) but I'm commenting anyway. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=085a54d9d9ac170c5d83f58a4044ae87b7a9d8a5;p=p5sagit%2Fp5-mst-13.2.git NI-S doesn't need these comments :-) but I'm commenting anyway. p4raw-id: //depot/perl@17166 --- diff --git a/locale.c b/locale.c index 5626688..1abda3e 100644 --- a/locale.c +++ b/locale.c @@ -474,6 +474,16 @@ Perl_init_i18nl10n(pTHX_ int printwarn) #endif /* USE_LOCALE */ { + /* Set PL_wantut8 to TRUE if any of the following are true: + - nl_langinfo(CODESET) contains /^utf-?8/i + - $ENV{LANGUAGE} contains /^utf-?8/i (only if using glibc) + - $ENV{LC_CALL} contains /^utf-?8/i + - $ENV{LC_CTYPE} contains /^utf-?8/i + - $ENV{LANG} contains /^utf-?8/i + If PL_wantutf8 is true the perl.c:S_parse_body() + will turn on the PerlIO :utf8 discipline on STDIN, STDOUT, + STDERR, _and_ the default open discipline. + */ bool wantutf8 = FALSE; char *codeset = NULL; #if defined(HAS_NL_LANGINFO) && defined(CODESET) diff --git a/perl.c b/perl.c index ee33a9c..8566e5f 100644 --- a/perl.c +++ b/perl.c @@ -1478,10 +1478,15 @@ print \" \\@INC:\\n @INC\\n\";"); if (!PL_do_undump) init_postdump_symbols(argc,argv,env); + /* PL_wantutf8 is conditionally turned on by + * locale.c:Perl_init_i18nl10n() if the environment + * look like the user wants to use UTF-8. */ if (PL_wantutf8) { /* Requires init_predump_symbols(). */ IO* io; PerlIO* fp; SV* sv; + /* Turn on UTF-8-ness on STDIN, STDOUT, STDERR + * _and_ the default open discipline. */ 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)))