Bug 19756: Fix encoding issues during the update DB process

To display the output of the updatedatabase.pl under Plack, we redirect
the output to a temporary file, read it, then display it.
We need to open it specifying the correct encoding (utf-8).

Test plan:
1. MariaDB [koha_kohadev]> update systempreferences set value="17.1100000"
where variable="version";
2. restart plack
3. Login
4. Make the update from the interface
=> Without this patch you will see encoding issue:
Upgrade to 17.12.00.000 done (Tē tōia, tē haumatia)
=> With this patch applied you will see :
Upgrade to 17.12.00.000 done (Tē tōia, tē haumatia)

Signed-off-by: Liz Rea <liz@catalyst.net.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2017-12-20 18:59:39 -03:00
parent ebc1583f09
commit df7fbba828
1 changed files with 2 additions and 2 deletions

View File

@ -394,7 +394,7 @@ elsif ( $step && $step == 3 ) {
system($cmd );
my $fh;
open( $fh, "<", $logfilepath )
open( $fh, "<:encoding(utf-8)", $logfilepath )
or die "Cannot open log file $logfilepath: $!";
my @report = <$fh>;
close $fh;
@ -407,7 +407,7 @@ elsif ( $step && $step == 3 ) {
else {
eval { `rm $logfilepath` };
}
open( $fh, "<", $logfilepath_errors )
open( $fh, "<:encoding(utf-8)", $logfilepath_errors )
or die "Cannot open log file $logfilepath_errors: $!";
@report = <$fh>;
close $fh;