Bug 7684: (follow-up) fix UTF-8 encoding problems in CSV export

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Galen Charlton 2013-11-01 00:25:08 +00:00
parent effd8f55f6
commit 9abfb7a764
1 changed files with 2 additions and 1 deletions

View File

@ -291,6 +291,7 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){
eval {use Text::CSV};
my $csv = Text::CSV->new or
die Text::CSV->error_diag ();
binmode STDOUT, ":encoding(UTF-8)";
print $input->header(
-type => 'text/csv',
-attachment => 'inventory.csv',
@ -300,7 +301,7 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){
foreach my $key ( keys %$columns_def_hashref ) {
my $initkey = $key;
$key =~ s/[^\.]*\.//;
$columns_def_hashref->{$initkey}=NormalizeString($columns_def_hashref->{$initkey});
$columns_def_hashref->{$initkey}=NormalizeString($columns_def_hashref->{$initkey} // '');
$columns_def_hashref->{$key} = $columns_def_hashref->{$initkey};
}