staged MARC import: handle non-ASCII characters in items
authorGalen Charlton <galen.charlton@liblime.com>
Thu, 31 Jan 2008 19:43:17 +0000 (13:43 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Sun, 3 Feb 2008 13:22:21 +0000 (07:22 -0600)
The problem occured during the population of
import_items.marcxml -- the MARC::Record object
created to store the item did not have the Leader/09
set to 'a', which means that MARC::File::XML
tried to transcode code the item from MARC-8 to UTF-8, which
breaks since the MARC data is already in UTF-8 at that point.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/ImportBatch.pm

index 028f87f..daa38a8 100644 (file)
@@ -269,7 +269,7 @@ sub  BatchStageMarcRecords {
         if ($progress_interval and (0 == ($rec_num % $progress_interval))) {
             &$progress_callback($rec_num);
         }
-        my $marc_record = FixEncoding($marc_blob, "\x1D");
+        my $marc_record = FixEncoding($marc_blob);
         my $import_record_id;
         if (scalar($marc_record->fields()) == 0) {
             push @invalid_records, $marc_blob;
@@ -312,6 +312,7 @@ sub AddItemsToImportBiblio {
     my ($item_tag,$item_subfield) = &GetMarcFromKohaField("items.itemnumber",'');
     foreach my $item_field ($marc_record->field($item_tag)) {
         my $item_marc = MARC::Record->new();
+        $item_marc->leader("00000    a              "); # must set Leader/09 to 'a'
         $item_marc->append_fields($item_field);
         $marc_record->delete_field($item_field);
         my $sth = $dbh->prepare_cached("INSERT INTO import_items (import_record_id, status, marcxml)