Bug 28796 - wrong number of parameters in new_from_xml call
Summary: wrong number of parameters in new_from_xml call
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Bibliographic record staging/import (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-02 12:04 UTC by Didier Gautheron
Modified: 2021-10-18 09:45 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Didier Gautheron 2021-08-02 12:04:40 UTC
Hi,

It seems to me that 
C4/ImportBatch.pm:                my $old_marc = MARC::Record->new_from_xml(StripNonXmlChars($oldxml), 'UTF-8', $rowref->{'encoding'}, $marc_type);

Is calling MARC::Record->new_from_xml with the wrong number of parameters and $marc_type is ignored it should be either:
MARC::Record->new_from_xml(StripNonXmlChars($oldxml), 'UTF-8', $marc_type);


or:
MARC::Record->new_from_xml(StripNonXmlChars($oldxml),$rowref->{'encoding'} , $marc_type);
Comment 1 Jonathan Druart 2021-08-03 08:47:02 UTC
Yes, that's wrong, it must be
  $rowref->{'encoding'} , $marc_type
Comment 2 Julian Maurice 2021-10-18 09:45:51 UTC
I tried to import a MARCXML file encoded in ISO-8859-1. I set the correct encoding in the form but no records were imported and I have this message in logfile:

bib-1.iso88591.marcxml: :15: parser error : Input is not proper UTF-8, indicate encoding !                                                                                  
Bytes: 0xE0 0x20 0x6D 0x6F
    <subfield code="a">�</subfield>

The error is located in C4::ImportBatch::RecordsFromMARCXMLFile

MARC::File::XML::decode seems to ignore the encoding passed in parameters.