View | Details | Raw Unified | Return to bug 11679
Collapse All | Expand All

(-)a/reports/guided_reports.pl (-5 / +3 lines)
Lines 19-25 Link Here
19
19
20
20
21
use CGI qw/-utf8/;
21
use CGI qw/-utf8/;
22
use Text::CSV;
22
use Text::CSV::Encoded;
23
use URI::Escape;
23
use URI::Escape;
24
use File::Temp;
24
use File::Temp;
25
use C4::Reports::Guided;
25
use C4::Reports::Guided;
Lines 772-778 elsif ($phase eq 'Run this report'){ Link Here
772
}
772
}
773
773
774
elsif ($phase eq 'Export'){
774
elsif ($phase eq 'Export'){
775
    binmode STDOUT, ':encoding(UTF-8)';
776
775
777
	# export results to tab separated text or CSV
776
	# export results to tab separated text or CSV
778
	my $sql    = $input->param('sql');  # FIXME: use sql from saved report ID#, not new user-supplied SQL!
777
	my $sql    = $input->param('sql');  # FIXME: use sql from saved report ID#, not new user-supplied SQL!
Lines 789-796 elsif ($phase eq 'Export'){ Link Here
789
        } else {
788
        } else {
790
            my $delimiter = C4::Context->preference('delimiter') || ',';
789
            my $delimiter = C4::Context->preference('delimiter') || ',';
791
            my $csv_content = q||;
790
            my $csv_content = q||;
792
            my $csv = Text::CSV->new({binary => 1, sep_char => $delimiter});
791
            my $csv = Text::CSV::Encoded->new({ encoding_out => 'utf8', sep_char => $delimiter});
793
            $csv or die "Text::CSV->new({binary => 1}) FAILED: " . Text::CSV->error_diag();
792
            $csv or die "Text::CSV::Encoded->new({binary => 1}) FAILED: " . Text::CSV::Encoded->error_diag();
794
            if ($csv->combine(header_cell_values($sth))) {
793
            if ($csv->combine(header_cell_values($sth))) {
795
                $csv_content .= $csv->string(). "\n";
794
                $csv_content .= $csv->string(). "\n";
796
            } else {
795
            } else {
797
- 

Return to bug 11679