Bug 24827: Specify UTF-8 as encoding in new_from_xml()
authorAndreas Roussos <a.roussos@dataly.gr>
Sun, 15 Mar 2020 07:43:25 +0000 (08:43 +0100)
committerJoy Nelson <joy@bywatersolutions.com>
Fri, 3 Apr 2020 18:14:07 +0000 (18:14 +0000)
commitab2a1b82052c00c2230c162763975ec0ac8dc989
tree07da33246634748df5b81a20067131fc8c9280e7
parentf7729a02547ec1b4e71b13c70757bb48ad622b51
Bug 24827: Specify UTF-8 as encoding in new_from_xml()

The MARC preview of staged records fails when a staged record contains
items with UTF-8 characters (see attached screenshots). That's because
in EmbedItemsInImportBiblio() the call to MARC::Record->new_from_xml()
does not explicitly specify 'UTF-8' as the optional encoding to use.

This patch fixes that.

Test plan (in a MARC21 instance):
0) Stage for import the test record attached to this bug report (make
   sure that 'Check for embedded item record data?' is set to 'Yes'),
   then go to Home > Tools > Manage staged MARC records and click on
   the filename you've just staged.
1) In the 'Citation' column, click on the hyperlink to launch the MARC
   preview -- notice how it fails to produce any output apart from the
   modal heading.
2) Apply the patch, and restart Plack if necessary.
3) Re-launch the MARC preview: this time the output should include the
   whole record, including the embedded item data in field 952.
4) Run the unit tests to ensure nothing was broken inadvertently:
   $ prove t
   $ prove xt

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
C4/ImportBatch.pm
Koha/BiblioUtils/Iterator.pm
t/db_dependent/Koha/Z3950Responder/GenericSession.t
t/db_dependent/Koha/Z3950Responder/ZebraSession.t