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

(-)a/reports/guided_reports.pl (-3 / +3 lines)
Lines 816-821 elsif ($phase eq 'Export'){ Link Here
816
        if ($format eq 'tab') {
816
        if ($format eq 'tab') {
817
            $type = 'application/octet-stream';
817
            $type = 'application/octet-stream';
818
            $content .= join("\t", header_cell_values($sth)) . "\n";
818
            $content .= join("\t", header_cell_values($sth)) . "\n";
819
            $content = Encode::decode('UTF-8', $content);
819
            while (my $row = $sth->fetchrow_arrayref()) {
820
            while (my $row = $sth->fetchrow_arrayref()) {
820
                $content .= join("\t", @$row) . "\n";
821
                $content .= join("\t", @$row) . "\n";
821
            }
822
            }
Lines 823-832 elsif ($phase eq 'Export'){ Link Here
823
            my $delimiter = C4::Context->preference('delimiter') || ',';
824
            my $delimiter = C4::Context->preference('delimiter') || ',';
824
            if ( $format eq 'csv' ) {
825
            if ( $format eq 'csv' ) {
825
                $type = 'application/csv';
826
                $type = 'application/csv';
826
                my $csv = Text::CSV::Encoded->new({ encoding_out => 'utf8', sep_char => $delimiter});
827
                my $csv = Text::CSV::Encoded->new({ encoding_out => 'UTF-8', sep_char => $delimiter});
827
                $csv or die "Text::CSV::Encoded->new({binary => 1}) FAILED: " . Text::CSV::Encoded->error_diag();
828
                $csv or die "Text::CSV::Encoded->new({binary => 1}) FAILED: " . Text::CSV::Encoded->error_diag();
828
                if ($csv->combine(header_cell_values($sth))) {
829
                if ($csv->combine(header_cell_values($sth))) {
829
                    $content .= $csv->string(). "\n";
830
                    $content .= Encode::decode('UTF-8', $csv->string()) . "\n";
830
                } else {
831
                } else {
831
                    push @$q_errors, { combine => 'HEADER ROW: ' . $csv->error_diag() } ;
832
                    push @$q_errors, { combine => 'HEADER ROW: ' . $csv->error_diag() } ;
832
                }
833
                }
833
- 

Return to bug 15290