p4raw-id: //depot/perlio@9549
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;
}
# 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";
}