mirror of https://github.com/digint/btrbk
Set STDERR, STDOUT, log file and config file binmode to UTF8
In addition use three argument open for opening the log file instead of combining the mode and filename together.pull/235/head
parent
1d0d57ffac
commit
68164d21e5
8
btrbk
8
btrbk
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings FATAL => qw( all ), NONFATAL => qw( deprecated );
|
use warnings FATAL => qw( all ), NONFATAL => qw( deprecated );
|
||||||
|
binmode STDOUT, ':encoding(UTF-8)';
|
||||||
|
binmode STDERR, ':encoding(UTF-8)';
|
||||||
|
|
||||||
use Carp qw(confess);
|
use Carp qw(confess);
|
||||||
use Getopt::Long qw(GetOptions);
|
use Getopt::Long qw(GetOptions);
|
||||||
|
|
@ -417,7 +419,9 @@ sub init_transaction_log($$)
|
||||||
my $file = shift;
|
my $file = shift;
|
||||||
my $config_syslog_facility = shift;
|
my $config_syslog_facility = shift;
|
||||||
if(defined($file) && (not $dryrun)) {
|
if(defined($file) && (not $dryrun)) {
|
||||||
if(open($tlog_fh, ">> $file")) {
|
if(open($tlog_fh, '>>', $file)) {
|
||||||
|
binmode $tlog_fh, ':encoding(UTF-8)';
|
||||||
|
|
||||||
# print headers (disabled)
|
# print headers (disabled)
|
||||||
# print_formatted("transaction", [ ], output_format => "tlog", outfile => $tlog_fh);
|
# print_formatted("transaction", [ ], output_format => "tlog", outfile => $tlog_fh);
|
||||||
INFO "Using transaction log: $file";
|
INFO "Using transaction log: $file";
|
||||||
|
|
@ -3535,6 +3539,8 @@ sub parse_config(@)
|
||||||
|
|
||||||
INFO "Using configuration: $file";
|
INFO "Using configuration: $file";
|
||||||
open(FILE, '<', $file) or die $!;
|
open(FILE, '<', $file) or die $!;
|
||||||
|
binmode FILE, ':encoding(UTF-8)';
|
||||||
|
|
||||||
while (<FILE>) {
|
while (<FILE>) {
|
||||||
chomp;
|
chomp;
|
||||||
s/#.*//; # remove comments
|
s/#.*//; # remove comments
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue