From: Jarkko Hietaniemi Date: Mon, 17 Feb 2003 04:44:53 +0000 (+0000) Subject: Make also the -CAL conditional on locale. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ce81ff128f8fe94cb13ace56aa6d974168cbdf12;p=p5sagit%2Fp5-mst-13.2.git Make also the -CAL conditional on locale. p4raw-id: //depot/perl@18730 --- diff --git a/perl.c b/perl.c index 4893762..866c9a8 100644 --- a/perl.c +++ b/perl.c @@ -3431,8 +3431,10 @@ Perl_init_argv_symbols(pTHX_ register int argc, register char **argv) for (; argc > 0; argc--,argv++) { SV *sv = newSVpv(argv[0],0); av_push(GvAVn(PL_argvgv),sv); - if (PL_unicode & PERL_UNICODE_ARGV_FLAG) - SvUTF8_on(sv); + if (!(PL_unicode & PERL_UNICODE_LOCALE_FLAG) || PL_utf8locale) { + if (PL_unicode & PERL_UNICODE_ARGV_FLAG) + SvUTF8_on(sv); + } if (PL_unicode & PERL_UNICODE_WIDESYSCALLS_FLAG) /* Sarathy? */ (void)sv_utf8_decode(sv); } diff --git a/pod/perlrun.pod b/pod/perlrun.pod index f434289..e38ad3d 100644 --- a/pod/perlrun.pod +++ b/pod/perlrun.pod @@ -281,28 +281,30 @@ listing the letters is equal to summing the numbers. o 16 the default output layer enforces UTF-8 D 24 i + o A 32 the @ARGV elements are supposed to be in UTF-8 - L 64 normally the IOEio (SD) are unconditional, + L 64 normally the "IOEioA" are unconditional, the L makes them conditional on the locale environment - variables (the LC_ALL, LC_TYPE, and LANG; in the order - of decreasing precedence) + variables (the LC_ALL, LC_TYPE, and LANG, in the order + of decreasing precedence) -- if the variables indicate + UTF-8, then the selected "IOEioA" are in effect For example, C<-COE> and C<-C6> will both turn on UTF-8-ness on both STDOUT and STDERR. Repeating letters is just redundant, not cumulative nor toggling. -The C<-C> on its own (not followed by any number or option list) has -the same effect as <-CSDL>. In other words, the standard I/O handles -and the default C layer are UTF-8-fied B only if the locale -environment variables indicate a UTF-8 locale. This behavior follows -the I behaviour of Perl 5.8.0. +The C<-C> on its own (not followed by any number or option list), +or an empty string as the C<$ENV{PERL_UNICODE}), has the same effect +as <-CSDL>. In other words, the standard I/O handles and the default +C layer are UTF-8-fied B only if the locale environment +variables indicate a UTF-8 locale. This behavior follows the I +UTF-8 behaviour of Perl 5.8.0. You can use C<-C0> to explicitly disable all the above Unicode features. See L, L, and L for more information. -The magic variable C<${^UNICODE}> reflects the state of this setting, -see L. (Another way of setting this variable -is to set the environment variable PERL_UNICODE.) +The read-only magic variable C<${^UNICODE}> reflects the state of this +setting, see L. (Another way of setting this +variable is to set the environment variable PERL_UNICODE.) (In Perls earlier than 5.8.1 the C<-C> switch was a Win32-only switch that enabled the use of Unicode-aware "wide system call" Win32 APIs.