From a7ffb6cdee673075f1ab54e8d262fc069639d815 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 17 Aug 2018 12:07:55 -0300 Subject: [PATCH] Bug 21142: Open uploaded files in utf-8 - batch mod/del MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Batch item/record modification/deletion tools does not open uploaded files in utf-8 Test plan: Edit and delete records and items using a file which will contain: valid and invalid barcodes with and without utf-8 chars (💕) You should see the warning message: "The *** 39999000💕001679 does not exist in the database." Signed-off-by: Owen Leonard Signed-off-by: Tomas Cohen Arazi --- tools/batchMod.pl | 1 + tools/batch_delete_records.pl | 1 + tools/batch_record_modification.pl | 1 + 3 files changed, 3 insertions(+) diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 0e985a2c7b..503f5cec63 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -237,6 +237,7 @@ if ($op eq "show"){ my @contentlist; if ($filefh){ + binmode $filefh, ':encoding(UTF-8)'; while (my $content=<$filefh>){ $content =~ s/[\r\n]*$//; push @contentlist, $content if $content; diff --git a/tools/batch_delete_records.pl b/tools/batch_delete_records.pl index 8804e6292a..149b44ddc0 100755 --- a/tools/batch_delete_records.pl +++ b/tools/batch_delete_records.pl @@ -57,6 +57,7 @@ if ( $op eq 'form' ) { $recordtype = 'biblio'; } elsif ( my $uploadfile = $input->param('uploadfile') ) { # A file of id is given + binmode $uploadfile, ':encoding(UTF-8)'; while ( my $content = <$uploadfile> ) { next unless $content; $content =~ s/[\r\n]*$//; diff --git a/tools/batch_record_modification.pl b/tools/batch_record_modification.pl index bfdb7583f5..2b7608469b 100755 --- a/tools/batch_record_modification.pl +++ b/tools/batch_record_modification.pl @@ -105,6 +105,7 @@ if ( $op eq 'form' ) { $recordtype = 'biblio'; } elsif ( my $uploadfile = $input->param('uploadfile') ) { # A file of id is given + binmode $uploadfile, ':encoding(UTF-8)'; while ( my $content = <$uploadfile> ) { next unless $content; $content =~ s/[\r\n]*$//; -- 2.18.0