[Koha] Please help with migration from Liber Media
Serhij Dubyk
Serhij Dubyk
Fri Mar 23 03:36:56 NZST 2007
I have records, exported from Liber-Media LS in UniMarc format.
This records in encoding 'cp866' /cyryllic DOS/
(can't changed for utf8 when exported).
It's need to convert this records to utf-8 and rearrange few fields.
I'm write small script for reading this file:
=======================================
#!/usr/bin/perl -w
use Getopt::Long;
use Pod::Usage;
use Encode;
use MARC::Batch;
use MARC::File;
use MARC::File::USMARC;
use MARC::Record;
use MARC::Charset;
MARC::Charset->ignore_errors(1);
use strict;
my $input_file_encoding="cp866";
my $output_encoding="utf-8";
my $input_file;
sub my_recode
{
my $string=decode($input_file_encoding,shift);
return encode($output_encoding,$string);
}
if($ENV{'QUERY_STRING'})
{($input_file)=split(/\?/,$ENV{'QUERY_STRING'},1);}
else
{$input_file=$ARGV[0];}
print "Input marc-file: $input_file\n";
my $marc_file = MARC::Batch->new( 'USMARC', $input_file );
$marc_file->warnings_off();
$marc_file->strict_off();
my $record_count=0;
while(my $record=$marc_file->next() )
{
$record_count++;
print "\nRECORD $record_count\n";
my $record_leader=$record->leader();
print "
'LEADER=".&my_recode($record_leader)."'[encoding:".$record->encoding()."]\n";
foreach my $field ($record->fields())
{
if($field->is_control_field())
{print "
'CONTROLFIELD[".&my_recode($field->tag())."]=".&my_recode($field->data())."'\n";}
else
{
foreach my $subfield ($field->subfields())
{
print "
'FIELD[".&my_recode($field->tag())."]:SUBFIELD[".&my_recode($subfield->[0])."]=".&my_recode($subfield->[1])."'\n";
}
}
}
}
undef $marc_file;
=======================================
but records printed with many errors.
Similar with on-line service
http://marcpm.sourceforge.net/cgi-bin/converter.cgi
and http://balno.free.fr/iso2txt/iso2txt.pl too
File
http://www.library.lviv.ua/software/koha/test_records/marc_liber_media_cp866.ldb
look good inside IMHO
Some ideas?
--
View this message in context: http://www.nabble.com/Please-help-with-migration-from-Liber-Media-tf3448377.html#a9617408
Sent from the Koha - Discuss mailing list archive at Nabble.com.
More information about the Koha
mailing list