From 718ff8b3397c3b63309beec15f369932a1662b80 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 31 Jan 2008 13:43:17 -0600 Subject: [PATCH] staged MARC import: handle non-ASCII characters in items 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 Signed-off-by: Joshua Ferraro --- C4/ImportBatch.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index 028f87fb20..daa38a8548 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -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) -- 2.39.5