From 9abfb7a7645388b159bfb0a249d98f9fe29cde1f Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 1 Nov 2013 00:25:08 +0000 Subject: [PATCH] Bug 7684: (follow-up) fix UTF-8 encoding problems in CSV export Signed-off-by: Galen Charlton --- tools/inventory.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/inventory.pl b/tools/inventory.pl index f5a542b20d..3d8939e090 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -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}; } -- 2.39.5