Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 945793f0

Von Moritz Bunkus vor etwa 9 Jahren hinzugefügt

  • ID 945793f0b279b59e89523634dd998cc17766f31f
  • Vorgänger 858d25a8
  • Nachfolger 54746051

SL::DBUpgrade2: Dateien direkt als UTF-8 öffnen und SL::IConv nicht nutzen

Unterschiede anzeigen:

SL/DBUpgrade2.pm
7 7
use SL::Common;
8 8
use SL::DBUpgrade2::Base;
9 9
use SL::DBUtils;
10
use SL::Iconv;
11 10

  
12 11
use strict;
13 12

  
......
52 51
  my $path = $self->path;
53 52

  
54 53
  foreach my $file_name (<$path/*.sql>, <$path/*.pl>) {
55
    next unless (open(IN, $file_name));
54
    next unless (open(IN, "<:encoding(UTF-8)", $file_name));
56 55

  
57 56
    my $file = $file_name;
58 57
    $file =~ s|.*/||;
......
133 132
  my ($self, $dbh, $filename, $version_or_control) = @_;
134 133

  
135 134
  my $form  = $self->{form};
136
  my $fh    = IO::File->new($filename, "r");
135
  my $fh    = IO::File->new($filename, "<:encoding(UTF-8)");
137 136
  my $query = "";
138 137
  my $sth;
139 138
  my @quote_chars;
......
146 145
  $dbh->begin_work();
147 146

  
148 147
  while (<$fh>) {
149
    $_ = SL::Iconv::convert('UTF-8', 'UTF-8', $_);
150

  
151 148
    # Remove DOS and Unix style line endings.
152 149
    chomp;
153 150

  
......
333 330

  
334 331
  $self->{form}->{login} ||= 'admin';
335 332

  
336
  map { $_->{description} = SL::Iconv::convert('UTF-8', 'UTF-8', $_->{description}) } values %{ $self->{all_controls} };
337

  
338 333
  if ($called_from_admin) {
339 334
    $self->{form}->{title} = $::locale->text('Dataset upgrade');
340 335
    $self->{form}->header;

Auch abrufbar als: Unified diff