Browse Source

Bug 27673: Fix encoding issues - Dump

Same as Load, but for Dump.

Test plan:
Edit ES mappings, replace withdrawn's label with "withdrawn ✔️ ❤️ ★"
Export the mappings
  perl misc/search_tools/export_elasticsearch_mappings.pl > admin/searchengine/elasticsearch/mappings.yaml
Reset mappings from the UI
=> Notice that the label is correct

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.05.x
Jonathan Druart 3 years ago
parent
commit
a562101fdc
  1. 5
      misc/migration_tools/bulkmarcimport.pl
  2. 3
      misc/search_tools/export_elasticsearch_mappings.pl
  3. 1
      reports/reserves_stats.pl

5
misc/migration_tools/bulkmarcimport.pl

@ -16,6 +16,7 @@ use MARC::File::XML;
use MARC::Record;
use MARC::Batch;
use MARC::Charset;
use Encode;
use Koha::Script;
use C4::Context;
@ -565,7 +566,7 @@ if ($logfile){
}
if ($yamlfile) {
open my $yamlfileout, q{>}, "$yamlfile" or die "cannot open $yamlfile \n";
print $yamlfileout YAML::XS::Dump($yamlhash);
print $yamlfileout YAML::XS::Dump(Encode::decode_utf8($yamlhash));
}
exit 0;
@ -633,7 +634,7 @@ sub get_heading_fields{
if ($authtypes){
$headingfields = YAML::XS::LoadFile($authtypes);
$headingfields={C4::Context->preference('marcflavour')=>$headingfields};
$debug && warn YAML::XS::Dump($headingfields);
$debug && warn YAML::XS::Dump(Encode::decode_utf8($headingfields));
}
unless ($headingfields){
$headingfields=$dbh->selectall_hashref("SELECT auth_tag_to_report, authtypecode from auth_types",'auth_tag_to_report',{Slice=>{}});

3
misc/search_tools/export_elasticsearch_mappings.pl

@ -52,6 +52,7 @@ Full documentation.
=cut
use Modern::Perl;
use Encode;
use Koha::Script;
use Koha::Database;
@ -81,4 +82,4 @@ if ( $type && $type !~ /^(marc21|unimarc|normarc)$/ ) {
my $mappings = Koha::SearchEngine::Elasticsearch::raw_elasticsearch_mappings( $type );
binmode STDOUT, ":encoding(UTF-8)";
print YAML::XS::Dump($mappings);
print Encode::decode_utf8( YAML::XS::Dump($mappings) );

1
reports/reserves_stats.pl

@ -218,7 +218,6 @@ sub calculate {
my @sqlorparams;
my @sqlor;
my @sqlwhere;
($debug) and print STDERR YAML::XS::Dump($filters_hashref);
foreach my $filter (keys %$filters_hashref){
my $string;
my $stringfield=$filter;

Loading…
Cancel
Save