Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1465be33

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

CSV-Export mit UTF-8 als Encoding gefixt

Dabei die Abhängigkeit vom Modul IO::Wrap beseitigt.

Unterschiede anzeigen:

SL/InstallationCheck.pm
18 18
  { name => "DBD::Pg",         version => '1.49',  url => "http://search.cpan.org/~dbdpg/" },
19 19
  { name => "Email::Address",                      url => "http://search.cpan.org/~rjbs/" },
20 20
  { name => "FCGI",                                url => "http://search.cpan.org/~mstrout/" },
21
  { name => "IO::Wrap",        version => '2.110', url => "http://search.cpan.org/~dskoll/" },
22 21
  { name => "List::MoreUtils", version => '0.21',  url => "http://search.cpan.org/~vparseval/" },
23 22
  { name => "PDF::API2",       version => '2.000', url => "http://search.cpan.org/~areibens/" },
24 23
  { name => "Template",        version => '2.18',  url => "http://search.cpan.org/~abw/" },
SL/ReportGenerator.pm
1 1
package SL::ReportGenerator;
2 2

  
3 3
use Data::Dumper;
4
use IO::Wrap;
5 4
use List::Util qw(max);
6 5
use Text::CSV_XS;
7 6
#use PDF::API2;    # these two eat up to .75s on startup. only load them if we actually need them
......
688 687
}
689 688

  
690 689
sub unescape_string {
691
  my $self  = shift;
692
  my $text  = shift;
690
  my ($self, $text, $do_iconv) = @_;
693 691

  
694
  $text     = $main::locale->unquote_special_chars('HTML', $text);
695
  $text     = $::locale->{iconv}->convert($text);
692
  $text = $main::locale->unquote_special_chars('HTML', $text);
693
  $text = $::locale->{iconv}->convert($text) if $do_iconv;
696 694

  
697 695
  return $text;
698 696
}
......
718 716
                                'quote_char'  => $quote_char,
719 717
                                'eol'         => $eol, });
720 718

  
721
  my $stdout          = wraphandle(\*STDOUT);
722 719
  my @visible_columns = $self->get_visible_columns('CSV');
723 720

  
721
  my $stdout;
722
  open $stdout, '>-';
723
  binmode $stdout, ':encoding(utf8)' if $::locale->is_utf8;
724

  
724 725
  if ($opts->{headers}) {
725 726
    if (!$self->{custom_headers}) {
726
      $csv->print($stdout, [ map { $self->unescape_string($self->{columns}->{$_}->{text}) } @visible_columns ]);
727
      $csv->print($stdout, [ map { $self->unescape_string($self->{columns}->{$_}->{text}, 1) } @visible_columns ]);
727 728

  
728 729
    } else {
729 730
      foreach my $row (@{ $self->{custom_headers} }) {
doc/INSTALL.texi
76 76
@item
77 77
Email::Address
78 78
@item
79
IO::Wrap (aus dem Paket IO::Stringy)
80
@item
81 79
List::MoreUtils
82 80
@item
83 81
PDF::API2
doc/INSTALL.txt
68 68

  
69 69
   * Email::Address
70 70

  
71
   * IO::Wrap (aus dem Paket IO::Stringy)
72

  
73 71
   * List::MoreUtils
74 72

  
75 73
   * PDF::API2
doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html
17 17
  pre.smallexample { font-size:smaller }
18 18
  pre.smalllisp    { font-size:smaller }
19 19
  span.sc    { font-variant:small-caps }
20
  span.roman { font-family:serif; font-weight:normal; } 
21
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
20
  span.roman { font-family:serif; font-weight:normal; }
21
  span.sansserif { font-family:sans-serif; font-weight:normal; }
22 22
--></style>
23 23
</head>
24 24
<body>
......
46 46
<li>DBI
47 47
<li>DBD::Pg
48 48
<li>Email::Address
49
<li>IO::Wrap (aus dem Paket IO::Stringy)
50 49
<li>List::MoreUtils
51 50
<li>PDF::API2
52 51
<li>Template
doc/UPGRADE
109 109
neu hinzugekommen:
110 110

  
111 111
- Achive::Zip
112
- IO::Wrap (aus dem Paket "IO::Stringy")
113 112
- Template
114 113
- Text::CSV_XS
115 114
- Text::Iconv

Auch abrufbar als: Unified diff