Merge pull request #362 from percona/PT-1611

PT-1611 pt-archiver support writing the output having utf-8 chars
This commit is contained in:
Carlos Salguero
2018-09-10 15:06:51 -03:00
committed by GitHub

View File

@@ -6646,6 +6646,8 @@ sub main {
my $need_hdr = $o->get('header') && !-f $archive_file; my $need_hdr = $o->get('header') && !-f $archive_file;
$archive_fh = IO::File->new($archive_file, ">>$charset") $archive_fh = IO::File->new($archive_file, ">>$charset")
or die "Cannot open $charset $archive_file: $OS_ERROR\n"; or die "Cannot open $charset $archive_file: $OS_ERROR\n";
binmode STDOUT, ":utf8";
binmode $archive_fh, ":utf8";
$archive_fh->autoflush(1) unless $o->get('buffer'); $archive_fh->autoflush(1) unless $o->get('buffer');
if ( $need_hdr ) { if ( $need_hdr ) {
print { $archive_fh } '', escape(\@sel_cols, $fields_separated_by, $optionally_enclosed_by), "\n" print { $archive_fh } '', escape(\@sel_cols, $fields_separated_by, $optionally_enclosed_by), "\n"