From: Nick Ing-Simmons Date: Wed, 4 Apr 2001 18:56:15 +0000 (+0000) Subject: Downgrade "Wide character in print" to a warning. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ae79846703a543a04b4fe449abfd6b1e08a9e149;p=p5sagit%2Fp5-mst-13.2.git Downgrade "Wide character in print" to a warning. p4raw-id: //depot/perlio@9549 --- diff --git a/doio.c b/doio.c index f6566bb..631149d 100644 --- a/doio.c +++ b/doio.c @@ -1204,8 +1204,11 @@ Perl_do_print(pTHX_ register SV *sv, PerlIO *fp) if (!SvUTF8(sv)) sv_utf8_upgrade(sv = sv_mortalcopy(sv)); } - else if (DO_UTF8(sv)) - sv_utf8_downgrade((sv = sv_mortalcopy(sv)), FALSE); + else if (DO_UTF8(sv)) { + if (!sv_utf8_downgrade((sv = sv_mortalcopy(sv)), TRUE)) { + Perl_warner(aTHX_ WARN_UTF8, "Wide character in print"); + } + } tmps = SvPV(sv, len); break; } diff --git a/t/io/utf8.t b/t/io/utf8.t index 52b641d..ac5cde7 100755 --- a/t/io/utf8.t +++ b/t/io/utf8.t @@ -135,8 +135,9 @@ print "ok 21\n"; # Now let's make it suffer. open F, ">", "a" or die $!; -eval { print F $a; }; -print "not " unless $@ and $@ =~ /Wide character in print/i; +my $w; +eval {local $SIG{__WARN__} = sub { $w = $_[0] }; print F $a; }; +print "not " if ($@ || $w !~ /Wide character in print/i); print "ok 22\n"; }