diff --git a/bantam.pl b/bantam.pl index 182e965..b0f481d 100755 --- a/bantam.pl +++ b/bantam.pl @@ -15,12 +15,9 @@ $SIG{__WARN__} = sub { warn $m; }; -# Make STDOUT/STDERR UTF-8 aware so decoded Unicode (model output, tool -# results) prints cleanly instead of triggering "Wide character in print". -binmode(STDOUT, ':encoding(UTF-8)'); -binmode(STDERR, ':encoding(UTF-8)'); -use File::Path qw(make_path); use POSIX qw(strftime); use Term::ReadLine; +binmode $_ => ':encoding(UTF-8)' for *STDIN, *STDOUT, *STDERR; +use File::Path qw(make_path); use POSIX qw(strftime); use Term::ReadLine; use constant MAX_DEPTH => 5; my $home = $ENV{HOME} || $ENV{USERPROFILE} || '.'; diff --git a/mb b/mb index f60b549..dff5cdb 100755 --- a/mb +++ b/mb @@ -6,7 +6,7 @@ use strict; use warnings; use HTTP::Tiny; use JSON::PP; use POSIX qw(strftime); $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /^Use of uninitialized value \$err in numeric eq \(==\) at .*IO\/Socket\/IP\.pm line \d+/ }; -binmode(STDOUT, ':encoding(UTF-8)'); binmode(STDERR, ':encoding(UTF-8)'); binmode(STDIN, ':encoding(UTF-8)'); +binmode $_ => ':encoding(UTF-8)' for *STDIN, *STDOUT, *STDERR; $| = 1; # unbuffered output: live spinner, responsive prompt