develooper Front page | perl.perl4lib | Postings from January 2012

RE: MARC::Record / MARC::File::XML bug when fields contain newlines?

Thread Previous
From:
Bryan Baldus
Date:
January 12, 2012 10:17
Subject:
RE: MARC::Record / MARC::File::XML bug when fields contain newlines?
Message ID:
AE5353CC4A55324E832DA208826294AC0105B0814913@QBIMAIL.qbi.quality-books.com
On Thursday, January 12, 2012 11:59 AM, arvinporthog@lycos.com [mailto:arvinporthog@lycos.com]  wrote:
>I could have sworn I have processed MARC records containing newlines with no problems in the past (I.e., not records converted from XML), though I've never tried to validate them with MARCEdit.
...
>Looks like MARC::Record is doing its job correctly. Perhaps changing MARC::File::XML is in order.

MARC::File::USMARC includes a line in sub _next:

     # remove illegal garbage that sometimes occurs between records
    $usmarc =~ s/^[ \x00\x0a\x0d\x1a]+//;

If I remember correctly, I believe this was added a few years ago in response to similar questions about new lines appearing in records (or after someone experienced problems with new lines and/or end-of-file characters in files of records--the new line removal may have always been there; I think I may have added 1A after finding it in some files I was working with).

I'm not familiar with MARC::File::XML to know how it deals with end of line characters.

----

Bryan Baldus
Cataloger
Quality Books Inc.
The Best of America's Independent Presses
1-800-323-4241x402
bryan.baldus@quality-books.com
eijabb@cpan.org
http://home.comcast.net/~eijabb/

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About