From: Jarkko Hietaniemi Date: Sun, 2 Mar 2003 13:34:13 +0000 (+0000) Subject: The -CI cannot be easily tested under UTF-8 locale with X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=06e66572fd5541df0d1349cac2b404c3b9e446ee;p=p5sagit%2Fp5-mst-13.2.git The -CI cannot be easily tested under UTF-8 locale with the t/test.pl (the 'stdin' data gets doubly UTF-8-ied). Also other small tweaks in the -C neighbourhood. p4raw-id: //depot/perl@18799 --- diff --git a/perl.c b/perl.c index e603ffc..70cd770 100644 --- a/perl.c +++ b/perl.c @@ -1357,14 +1357,15 @@ print \" \\@INC:\\n @INC\\n\";"); * PL_utf8locale is conditionally turned on by * locale.c:Perl_init_i18nl10n() if the environment * look like the user wants to use UTF-8. */ - if (PL_unicode) { /* Requires init_predump_symbols(). */ - IO* io; - PerlIO* fp; - SV* sv; - + if (PL_unicode) { + /* Requires init_predump_symbols(). */ if (!(PL_unicode & PERL_UNICODE_LOCALE_FLAG) || PL_utf8locale) { + IO* io; + PerlIO* fp; + SV* sv; + /* Turn on UTF-8-ness on STDIN, STDOUT, STDERR - * and the default open discipline. */ + * and the default open disciplines. */ if ((PL_unicode & PERL_UNICODE_STDIN_FLAG) && PL_stdingv && (io = GvIO(PL_stdingv)) && (fp = IoIFP(io))) diff --git a/perl.h b/perl.h index 462f0e3..88f011b 100644 --- a/perl.h +++ b/perl.h @@ -4175,15 +4175,22 @@ extern void moncontrol(int); #define PERL_UNICODE_STDIN_FLAG 0x0001 #define PERL_UNICODE_STDOUT_FLAG 0x0002 #define PERL_UNICODE_STDERR_FLAG 0x0004 -#define PERL_UNICODE_STD_FLAG 0x0007 #define PERL_UNICODE_IN_FLAG 0x0008 #define PERL_UNICODE_OUT_FLAG 0x0010 -#define PERL_UNICODE_INOUT_FLAG 0x0018 -#define PERL_UNICODE_ARGV_FLAG 0x0020 /* For @ARGV? */ +#define PERL_UNICODE_ARGV_FLAG 0x0020 #define PERL_UNICODE_LOCALE_FLAG 0x0040 #define PERL_UNICODE_WIDESYSCALLS_FLAG 0x0080 /* for Sarathy */ -#define PERL_UNICODE_DEFAULT_FLAGS \ +#define PERL_UNICODE_STD_FLAG \ + (PERL_UNICODE_STDIN_FLAG | \ + PERL_UNICODE_STDOUT_FLAG | \ + PERL_UNICODE_STDERR_FLAG) + +#define PERL_UNICODE_INOUT_FLAG \ + (PERL_UNICODE_IN_FLAG | \ + PERL_UNICODE_OUT_FLAG) + +#define PERL_UNICODE_DEFAULT_FLAGS \ (PERL_UNICODE_STD_FLAG | \ PERL_UNICODE_INOUT_FLAG | \ PERL_UNICODE_LOCALE_FLAG) diff --git a/t/run/switchC.t b/t/run/switchC.t index 9283fa8..ba17cb9 100644 --- a/t/run/switchC.t +++ b/t/run/switchC.t @@ -25,11 +25,18 @@ $r = runperl( switches => [ '-CO', '-w' ], stderr => 1 ); is( $r, "\xC4\x80", '-CO: no warning on UTF-8 output' ); -$r = runperl( switches => [ '-CI', '-w' ], - prog => 'print ord()', - stderr => 1, - stdin => chr(256) ); -is( $r, 256, '-CI: read in UTF-8 output' ); +SKIP: { + for my $l (qw(LC_ALL LC_CTYPE LANG)) { + skip("cannot easily test under UTF-8 locale", 1) + if $ENV{$l} =~ /utf-?8/i; + } + $r = runperl( switches => [ '-CI', '-w' ], + prog => 'print ord()', + stderr => 1, + verbose => 1, + stdin => "\xC4\x80" ); + is( $r, 256, '-CI: read in UTF-8 input' ); +} $r = runperl( switches => [ '-CE', '-w' ], prog => 'warn chr(256), qq(\n)', diff --git a/util.c b/util.c index e74fe71..e980707 100644 --- a/util.c +++ b/util.c @@ -4355,7 +4355,7 @@ Perl_parse_unicode_opts(pTHX_ char **popt) opt = PERL_UNICODE_DEFAULT_FLAGS; if (opt & ~PERL_UNICODE_ALL_FLAGS) - Perl_croak(aTHX_ "Unknown Unicode option value 0x%"UVuf, + Perl_croak(aTHX_ "Unknown Unicode option value %"UVuf, (UV) (opt & ~PERL_UNICODE_ALL_FLAGS)); *popt = p;