From 1465be33b0432ed41208b8f913f2bc4f54ef5d78 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 27 Dec 2010 17:53:17 +0100 Subject: [PATCH] CSV-Export mit UTF-8 als Encoding gefixt MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Dabei die Abhängigkeit vom Modul IO::Wrap beseitigt. --- SL/InstallationCheck.pm | 1 - SL/ReportGenerator.pm | 15 ++++++++------- doc/INSTALL.texi | 2 -- doc/INSTALL.txt | 2 -- .../Ben_00c3_00b6tigte-Software-und-Pakete.html | 5 ++--- doc/UPGRADE | 1 - 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/SL/InstallationCheck.pm b/SL/InstallationCheck.pm index d8d058bc5..15db0cb70 100644 --- a/SL/InstallationCheck.pm +++ b/SL/InstallationCheck.pm @@ -18,7 +18,6 @@ BEGIN { { name => "DBD::Pg", version => '1.49', url => "http://search.cpan.org/~dbdpg/" }, { name => "Email::Address", url => "http://search.cpan.org/~rjbs/" }, { name => "FCGI", url => "http://search.cpan.org/~mstrout/" }, - { name => "IO::Wrap", version => '2.110', url => "http://search.cpan.org/~dskoll/" }, { name => "List::MoreUtils", version => '0.21', url => "http://search.cpan.org/~vparseval/" }, { name => "PDF::API2", version => '2.000', url => "http://search.cpan.org/~areibens/" }, { name => "Template", version => '2.18', url => "http://search.cpan.org/~abw/" }, diff --git a/SL/ReportGenerator.pm b/SL/ReportGenerator.pm index f02f56875..2b37e78f5 100644 --- a/SL/ReportGenerator.pm +++ b/SL/ReportGenerator.pm @@ -1,7 +1,6 @@ package SL::ReportGenerator; use Data::Dumper; -use IO::Wrap; use List::Util qw(max); use Text::CSV_XS; #use PDF::API2; # these two eat up to .75s on startup. only load them if we actually need them @@ -688,11 +687,10 @@ sub _print_content { } sub unescape_string { - my $self = shift; - my $text = shift; + my ($self, $text, $do_iconv) = @_; - $text = $main::locale->unquote_special_chars('HTML', $text); - $text = $::locale->{iconv}->convert($text); + $text = $main::locale->unquote_special_chars('HTML', $text); + $text = $::locale->{iconv}->convert($text) if $do_iconv; return $text; } @@ -718,12 +716,15 @@ sub generate_csv_content { 'quote_char' => $quote_char, 'eol' => $eol, }); - my $stdout = wraphandle(\*STDOUT); my @visible_columns = $self->get_visible_columns('CSV'); + my $stdout; + open $stdout, '>-'; + binmode $stdout, ':encoding(utf8)' if $::locale->is_utf8; + if ($opts->{headers}) { if (!$self->{custom_headers}) { - $csv->print($stdout, [ map { $self->unescape_string($self->{columns}->{$_}->{text}) } @visible_columns ]); + $csv->print($stdout, [ map { $self->unescape_string($self->{columns}->{$_}->{text}, 1) } @visible_columns ]); } else { foreach my $row (@{ $self->{custom_headers} }) { diff --git a/doc/INSTALL.texi b/doc/INSTALL.texi index 23ba2e084..2120bc014 100644 --- a/doc/INSTALL.texi +++ b/doc/INSTALL.texi @@ -76,8 +76,6 @@ DBD::Pg @item Email::Address @item -IO::Wrap (aus dem Paket IO::Stringy) -@item List::MoreUtils @item PDF::API2 diff --git a/doc/INSTALL.txt b/doc/INSTALL.txt index 86d5687e8..70510d4cb 100644 --- a/doc/INSTALL.txt +++ b/doc/INSTALL.txt @@ -68,8 +68,6 @@ Bestandteil einer Standard-Perl-Installation sind: * Email::Address - * IO::Wrap (aus dem Paket IO::Stringy) - * List::MoreUtils * PDF::API2 diff --git a/doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html b/doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html index 52c3c51e8..bea9c255d 100644 --- a/doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html +++ b/doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html @@ -17,8 +17,8 @@ pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } - span.roman { font-family:serif; font-weight:normal; } - span.sansserif { font-family:sans-serif; font-weight:normal; } + span.roman { font-family:serif; font-weight:normal; } + span.sansserif { font-family:sans-serif; font-weight:normal; } --> @@ -46,7 +46,6 @@ aufwärts: Top
  • DBI
  • DBD::Pg
  • Email::Address -
  • IO::Wrap (aus dem Paket IO::Stringy)
  • List::MoreUtils
  • PDF::API2
  • Template diff --git a/doc/UPGRADE b/doc/UPGRADE index 0ad5fd168..190181850 100644 --- a/doc/UPGRADE +++ b/doc/UPGRADE @@ -109,7 +109,6 @@ der Datei "doc/INSTALL". Seit Version 2.4.0 sind die folgenden Module neu hinzugekommen: - Achive::Zip -- IO::Wrap (aus dem Paket "IO::Stringy") - Template - Text::CSV_XS - Text::Iconv -- 2.20.1