Bug 21142: Open uploaded files in utf-8 - batch mod/del

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 <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2018-08-17 12:07:55 -03:00 committed by Nick Clemens
parent d1890533c8
commit f5f31679bf
3 changed files with 3 additions and 0 deletions

View file

@ -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;

View file

@ -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]*$//;

View file

@ -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]*$//;