use MARC::Batch;
use Getopt::Long;
+use IO::File;
+
my ( $input_marc_file,$number,$nowarning,$frameworkcode) = ('',0);
my $version;
GetOptions(
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;
use MARC::Batch;
use Time::HiRes qw(gettimeofday);
use Getopt::Long;
+use IO::File;
+
my $input_marc_file = '';
my ($version);
GetOptions(
my $dbh = C4::Context->dbh;
my $sth2=$dbh->prepare("update biblioitems set marc=? where biblionumber=?");
-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();
$batch->strict_off();
my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField("biblio.biblionumber","");
use C4::Charset;
use C4::AuthoritiesMarc;
use Time::HiRes qw(gettimeofday);
-
use Getopt::Long;
+use IO::File;
+
my ( $input_marc_file, $number) = ('',0);
my ($version, $delete, $test_parameter,$char_encoding, $verbose, $format, $commit);
$| = 1;
$char_encoding = 'MARC21' unless ($char_encoding);
print "CHAR : $char_encoding\n" if $verbose;
my $starttime = gettimeofday;
+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;
if ($format =~ /XML/i) {
# ugly hack follows -- MARC::File::XML, when used by MARC::Batch,
# extract the records, not using regexes to look
# for <record>.*</record>.
$MARC::File::XML::_load_args{BinaryEncoding} = 'utf-8';
- $batch = MARC::Batch->new( 'XML', $input_marc_file );
+ $batch = MARC::Batch->new( 'XML', $fh );
} else {
- $batch = MARC::Batch->new( 'USMARC', $input_marc_file );
+ $batch = MARC::Batch->new( 'USMARC', $fh );
}
$batch->warnings_off();
$batch->strict_off();
use Unicode::Normalize;
use Time::HiRes qw(gettimeofday);
use Getopt::Long;
-binmode(STDOUT, ":utf8");
+use IO::File;
-use Getopt::Long;
+binmode(STDOUT, ":utf8");
my ( $input_marc_file, $number) = ('',0);
my ($version, $delete, $test_parameter, $skip_marc8_conversion, $char_encoding, $verbose, $commit, $fk_off,$format);
print "Characteristic MARC flavour: $marcFlavour\n" if $verbose;
my $starttime = gettimeofday;
my $batch;
+my $fh = IO::File->new($input_marc_file); # don't let MARC::Batch open the file, as it applies the ':utf8' IO layer
if ($format =~ /XML/i) {
# ugly hack follows -- MARC::File::XML, when used by MARC::Batch,
# appears to try to convert incoming XML records from MARC-8
# extract the records, not using regexes to look
# for <record>.*</record>.
$MARC::File::XML::_load_args{BinaryEncoding} = 'utf-8';
- $batch = MARC::Batch->new( 'XML', $input_marc_file );
+ $batch = MARC::Batch->new( 'XML', $fh );
} else {
- $batch = MARC::Batch->new( 'USMARC', $input_marc_file );
+ $batch = MARC::Batch->new( 'USMARC', $fh );
}
$batch->warnings_off();
$batch->strict_off();