Bug 15290: SQL reports headers encoding problem

To test:

- Create an SQL report with column names containing UTF characters
- Run the report
=> FAIL: The column names are double encoded
- Export the report
=> FAIL: The column names are double encoded in the exported file
- Apply the patch
- Re-run the report (reload works)
=> SUCCESS: Encoding correct
- Export the report
=> SUCCESS: Encoding correct
- Sign off :-D

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Tomás Cohen Arazi 2015-12-03 11:23:54 -03:00 committed by Kyle M Hall
parent 4f6bcc5cc9
commit 879b1386ff

View file

@ -771,7 +771,7 @@ elsif ($phase eq 'Run this report'){
unless ($sth) {
die "execute_query failed to return sth for report $report_id: $sql";
} else {
my $headers= header_cell_loop($sth);
my $headers = header_cell_loop($sth);
$template->param(header_row => $headers);
while (my $row = $sth->fetchrow_arrayref()) {
my @cells = map { +{ cell => $_ } } @$row;
@ -949,7 +949,7 @@ sub header_cell_values {
# pass $sth, get back a TMPL_LOOP-able set of names for the column headers
sub header_cell_loop {
my @headers = map { +{ cell => $_ } } header_cell_values (shift);
my @headers = map { +{ cell => decode('UTF-8',$_) } } header_cell_values (shift);
return \@headers;
}