From e2810dc2aa1e5095197ff102f6af3e1930e33379 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Wed, 5 May 2021 12:12:44 +0300 Subject: [PATCH] Bug 28281: Remove double decoding when importing installation data The YAML::XS::Load and YAML::XS::LoadFile functions already decode the YAML to Perl objects/strings, therefore decoding the output yet another time is not needed and causes an error to happen. To test: 1. Go through the following steps and notice without this patch the error happens and with this patch it doesn't: $ koha-mysql kohadev < installer/data/mysql/kohastructure.sql $ restart_all $ ./translate update pl-PL $ ./translate install pl-PL $ restart_all --> Go to the Koha web installer page and select pl-PL as the installer language, click through it and notice it gives following error at the MARC21 step: Cannot decode string with wide characters at /usr/lib/x86_64-linux-gnu/perl/5.24/Encode.pm line 202 Signed-off-by: Jonathan Druart Signed-off-by: Jonathan Druart --- C4/Installer.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Installer.pm b/C4/Installer.pm index 05b8025dbe..2d6b523eed 100644 --- a/C4/Installer.pm +++ b/C4/Installer.pm @@ -154,7 +154,7 @@ sub marc_framework_sql_list { my @lines; if ( $ext =~ /yml/ ) { my $yaml = YAML::XS::LoadFile("$dir/$requirelevel/$name\.$ext"); - @lines = map { Encode::decode('UTF-8', $_) } @{ $yaml->{'description'} }; + @lines = @{ $yaml->{'description'} }; } else { open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt"; my $line = <$fh>; @@ -237,7 +237,7 @@ sub sample_data_sql_list { my @lines; if ( $ext =~ /yml/ ) { my $yaml = YAML::XS::LoadFile("$dir/$requirelevel/$name\.$ext"); - @lines = map { Encode::decode('UTF-8', $_) } @{ $yaml->{'description'} }; + @lines = @{ $yaml->{'description'} }; } else { open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt"; my $line = <$fh>; -- 2.39.5