LDR/09 was never showing up as 'a' where it was being tested, and adding the
'a' was preventing a reconversion to UTF8. It somewhat looks like the UTF8
MARCXML input gets converted to MARC8 as part of MARC::Batch's magic, then
gets converted back to UTF8 by MARC::File::XML::as_xml_record(). Seems like
this would mean potential performance / encoding problems but it works, which
is better than what my meddlesome tests were doing.
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17776
dcc99617-32d9-48b4-a31d-
7c20da2025e4
$logger->info("processing record $count");
try {
- # Avoid an over-eager MARC::File::XML that may try to convert
- # our record from MARC8 to UTF8 and break because the record
- # is obviously already UTF8
- my $ldr = $r->leader();
- if (($marctype eq 'XML') && (substr($ldr, 9, 1) ne 'a')) {
- $logger->warn("MARCXML record LDR/09 was not 'a'; record leader may be corrupt");
- substr($ldr,9,1,'a');
- $r->leader($ldr);
- }
(my $xml = $r->as_xml_record()) =~ s/\n//sog;
$xml =~ s/^<\?xml.+\?\s*>//go;
$xml =~ s/>\s+</></go;