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
* 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)))
#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)
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)',
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;