From b0a677be7f106d5bf5dfec43d1d4ec2d57272e7c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 6 Apr 2021 16:26:23 +0200 Subject: [PATCH] Bug 28094: Deal with encoding for overriden sysprefs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The string we retrieved is UTF-8 encoded, to prevent encoding issue we must decode it first. Test plan: Easily testable with LibraryName: 1. edit /etc/apache2/sites-available/kohadev.conf 2. Add RequestHeader add X-Koha-SetEnv "OVERRIDE_SYSPREF_LibraryName Library of ❤️" 3. restart_all 4. Hit the mainpage and look at the source (or title) and confirm that the string is displayed correcty Signed-off-by: Lucas Gass Signed-off-by: Julian Maurice Signed-off-by: Jonathan Druart (cherry picked from commit c32d46b854a73e636b1568eab758868ea9d74a13) Signed-off-by: Fridolin Somers --- C4/Context.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Context.pm b/C4/Context.pm index 27c0e3ef8d..41c4629b22 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -406,7 +406,7 @@ sub preference { my $self = shift; my $var = shift; # The system preference to return - return $ENV{"OVERRIDE_SYSPREF_$var"} + return Encode::decode_utf8($ENV{"OVERRIDE_SYSPREF_$var"}) if defined $ENV{"OVERRIDE_SYSPREF_$var"}; $var = lc $var; -- 2.39.5