diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-02 13:34:13 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-02 13:34:13 +0000 |
commit | 06e66572fd5541df0d1349cac2b404c3b9e446ee (patch) | |
tree | 0930177519678f5a1dd34796e442ca89f1a91c98 | |
parent | 97edce3fcdc8a02187aed95f7b6f4a46eb120a6e (diff) | |
download | perl-06e66572fd5541df0d1349cac2b404c3b9e446ee.tar.gz |
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
-rw-r--r-- | perl.c | 13 | ||||
-rw-r--r-- | perl.h | 15 | ||||
-rw-r--r-- | t/run/switchC.t | 17 | ||||
-rw-r--r-- | util.c | 2 |
4 files changed, 31 insertions, 16 deletions
@@ -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))) @@ -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 9283fa879b..ba17cb91c1 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(<STDIN>)', - 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(<STDIN>)', + 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)', @@ -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; |