Bug 28094: Deal with encoding for overriden sysprefs

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 <lucas@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-04-06 16:26:23 +02:00
parent d57c65c2bd
commit c32d46b854
1 changed files with 1 additions and 1 deletions

View File

@ -405,7 +405,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;