@@ -, +, @@ UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 --- reports/guided_reports.pl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/reports/guided_reports.pl +++ a/reports/guided_reports.pl @@ -19,7 +19,7 @@ use CGI qw/-utf8/; -use Text::CSV; +use Text::CSV::Encoded; use URI::Escape; use File::Temp; use C4::Reports::Guided; @@ -772,7 +772,6 @@ elsif ($phase eq 'Run this report'){ } elsif ($phase eq 'Export'){ - binmode STDOUT, ':encoding(UTF-8)'; # export results to tab separated text or CSV my $sql = $input->param('sql'); # FIXME: use sql from saved report ID#, not new user-supplied SQL! @@ -789,8 +788,8 @@ elsif ($phase eq 'Export'){ } else { my $delimiter = C4::Context->preference('delimiter') || ','; my $csv_content = q||; - my $csv = Text::CSV->new({binary => 1, sep_char => $delimiter}); - $csv or die "Text::CSV->new({binary => 1}) FAILED: " . Text::CSV->error_diag(); + my $csv = Text::CSV::Encoded->new({ encoding_out => 'utf8', sep_char => $delimiter}); + $csv or die "Text::CSV::Encoded->new({binary => 1}) FAILED: " . Text::CSV::Encoded->error_diag(); if ($csv->combine(header_cell_values($sth))) { $csv_content .= $csv->string(). "\n"; } else { --