MT 2116: Addons to the CSV export

Fix encoding selection
This commit is contained in:
Matthias Meusburger 2010-02-03 09:39:38 +01:00 committed by Henri-Damien LAURENT
parent fda88bdd30
commit 59f8b71a62
5 changed files with 8 additions and 12 deletions

View File

@ -328,12 +328,12 @@ sub marc2endnote {
}
=head2 marcrecords2csv - Convert several records from UNIMARC to CSV
=head2 marc2csv - Convert several records from UNIMARC to CSV
Pre and postprocessing can be done through a YAML file
=over 4
my ($csv) = marcrecords2csv($biblios, $csvprofileid);
my ($csv) = marc2csv($biblios, $csvprofileid);
Returns a CSV scalar
@ -375,11 +375,11 @@ sub marc2csv {
return $output;
}
=head2 marc2csv - Convert a single record from UNIMARC to CSV
=head2 marcrecord2csv - Convert a single record from UNIMARC to CSV
=over 4
my ($csv) = marc2csv($biblio, $csvprofileid, $header);
my ($csv) = marcrecord2csv($biblio, $csvprofileid, $header);
Returns a CSV scalar
@ -415,7 +415,6 @@ sub marcrecord2csv {
# Getting output encoding
my $encoding = $profile->{encoding} || 'utf8';
# Getting separators
my $csvseparator = $profile->{csv_separator} || ',';
my $fieldseparator = $profile->{field_separator} || '#';
@ -426,7 +425,8 @@ sub marcrecord2csv {
if ($fieldseparator eq '\t') { $fieldseparator = "\t" }
if ($subfieldseparator eq '\t') { $subfieldseparator = "\t" }
$csv->encoding_out($encoding) if ($encoding ne 'utf8');
$csv = $csv->encoding_out($encoding) ;
$csv->sep_char($csvseparator);
# Getting the marcfields
@ -527,7 +527,7 @@ sub marcrecord2csv {
$csv->combine(@fieldstab);
$output .= $csv->string() . "\n";
return $output;
}

View File

@ -33,7 +33,6 @@ use C4::Record;
use C4::Ris;
use C4::Csv;
use utf8;
use open qw( :std :utf8);
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user (

View File

@ -33,7 +33,6 @@ use C4::Record;
use C4::Ris;
use C4::Csv;
use utf8;
use open qw( :std :utf8);
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user (

View File

@ -33,7 +33,6 @@ use C4::Record;
use C4::Ris;
use C4::Csv;
use utf8;
use open qw( :std :utf8);
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user (

View File

@ -33,7 +33,6 @@ use C4::Record;
use C4::Ris;
use C4::Csv;
use utf8;
use open qw( :std :utf8);
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
@ -82,7 +81,7 @@ if ($shelfid && $format) {
# If it was a CSV export we change the format after the export so the file extension is fine
$format = "csv" if ($format =~ m/^\d+$/);
print $query->header(
-type => 'application/octet-stream',
-'Content-Transfer-Encoding' => 'binary',