]> git.koha-community.org Git - koha.git/commit
Bug 24123: Fix import of UTF-8 encoded MARC21 MARCXML using bulkmarcimport (elastic...
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 10 Dec 2019 14:24:36 +0000 (15:24 +0100)
committerLucas Gass <lucas@bywatersolutions.com>
Wed, 5 Feb 2020 21:32:32 +0000 (21:32 +0000)
commit3e5eb8aacf39cab5bac519f9b173ba5a6c34abf3
treee14b02c31cf0ae490eb60a9220e99d86d4c1a70e
parenta273c604db5ebad8aef2b1076a0a5870783ba06e
Bug 24123: Fix import of UTF-8 encoded MARC21 MARCXML using bulkmarcimport (elastic only)

If elastic is used as search engine, the bulkmarcimport.pl will not
handle correctly UTF-8 encoded MARCXML

Koha::SearchEngine::Search->new uses a require statement to load the correct Search module.
This is done l.257 of bulkmarcimport.pl:
  257 my $searcher = Koha::SearchEngine::Search->new

Koha::SearchEngine::Elasticsearch::Search will `use MARC::File::XML`, and so resets the arguments set before:
  216     $MARC::File::XML::_load_args{BinaryEncoding} = 'utf-8';

  220     $MARC::File::XML::_load_args{RecordFormat} = $recordformat;

An easy (but dirty) fix could be to move the declaration of my $searcher before in the script.
The tricky (but correct) fix would be to remove the long standing "ugly hack follows" comment.

This patch is the easy, and dirty, fix

Test plan:
Use the command line tool to import MARXCML records that contains unicode characters into Koha

Something like `misc/migration_tools/bulkmarcimport.pl -biblios -file record.marcxml -m=MARCXML`

Without this patch you will notice that unicode characters will not be displayed correctly

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit b11946bc377ec2c6474f9dc2192fda8188c86888)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
misc/migration_tools/bulkmarcimport.pl