Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug 6799 rebuild_zebra.pl -x produces invalid XML records

This patch allow to handle properly items containing extended characters and
send valid XML records to zebraidx

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
  • Loading branch information...
commit 4ce57a102b1c0404bc4ae67032bcb1cbbc769fc7 1 parent 9c5d3ea
Frédéric Demians fredericd authored PaulPoulain committed

Showing 1 changed file with 5 additions and 7 deletions. Show diff stats Hide diff stats

  1. +5 7 misc/migration_tools/rebuild_zebra.pl
12 misc/migration_tools/rebuild_zebra.pl
@@ -323,19 +323,17 @@ sub export_marc_records_from_sth {
323 323 my @items = GetItemsInfo($record_number);
324 324 if (@items){
325 325 my $record = MARC::Record->new;
  326 + $record->encoding('UTF-8');
326 327 my @itemsrecord;
327 328 foreach my $item (@items){
328 329 my $record = Item2Marc($item, $record_number);
329 330 push @itemsrecord, $record->field($itemtag);
330 331 }
331 332 $record->insert_fields_ordered(@itemsrecord);
332   - my $itemsxml=$record->as_xml_record();
333   - my $searchstring = '<record>\n';
334   - my $index = index($itemsxml, '<record>\n', 0);
335   - $itemsxml = substr($itemsxml, $index + length($searchstring));
336   - $searchstring = '</record>';
337   - $marcxml = substr($marcxml, 0, index($marcxml, $searchstring));
338   - $marcxml .= $itemsxml;
  333 + my $itemsxml = $record->as_xml_record();
  334 + $marcxml =
  335 + substr($marcxml, 0, length($marcxml)-10) .
  336 + substr($itemsxml, index($itemsxml, "</leader>\n", 0) + 10);
339 337 }
340 338 }
341 339 if ( $marcxml ) {

0 comments on commit 4ce57a1

Please sign in to comment.
Something went wrong with that request. Please try again.