Followup release notes
[koha.git] / misc / batchCompareMARCvsFrameworks.pl
index 0b806f0..b0ed797 100755 (executable)
@@ -17,6 +17,8 @@ use MARC::Record;
 use MARC::Batch;
 
 use Getopt::Long;
+use IO::File;
+
 my ( $input_marc_file,$number,$nowarning,$frameworkcode) = ('',0);
 my $version;
 GetOptions(
@@ -49,7 +51,8 @@ EOF
 die;
 }#/
 
-my $batch = MARC::Batch->new( 'USMARC', $input_marc_file );
+my $fh = IO::File->new($input_marc_file); # don't let MARC::Batch open the file, as it applies the ':utf8' IO layer
+my $batch = MARC::Batch->new( 'USMARC', $fh );
 $batch->warnings_off() unless $nowarning;
 $batch->strict_off() unless $nowarning;
 my $dbh=C4::Context->dbh;
@@ -66,7 +69,7 @@ my $i=0;
 while ( my $record = $batch->next() ) {
     $i++;
     foreach my $MARCfield ($record->fields()) {
-    next if $MARCfield->tag()<=010;
+    next if $MARCfield->is_control_field(); # tag num < 10
         if ($MARCfield) {
             foreach my $fields ($MARCfield->subfields()) {
                 if ($fields) {