Thread Frage zur Parameterübergabe (8 answers)
Opened by jan99 at 2014-11-06 10:50

GwenDragon
 2014-11-06 12:54
#178153 #178153
User since
2005-01-17
14761 Artikel
Admin1
[Homepage]
user image
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

use strict;
use warnings;
use Encode qw/from_to/;

my $DEBUG = 0;

my ($file_from, $file_to) = @ARGV;
die "Argumente fehlen!" if @ARGV < 2; 

open (my $fh_in, '<', $file_from) or die "$file_from - $!";
open (my $fh_out, '>', $file_to)  or die "$file_to - $!";
while (my $line = <$fh_in>) {
   print STDERR "Original: $line" if $DEBUG;
   #from_to($line,"ANSI Latin1","utf8", Encode::FB_QUIET);
   # doppelte Rückcodierung erforderlich
   # siehe http://www.perl-community.de/bat/poard/thread/19290
   from_to($line,"Windows-1252","utf8", Encode::FB_QUIET);
   from_to($line,"utf8", "UTF-8", Encode::FB_QUIET);
   print $fh_out $line;
}
close ($fh_in) or die "$file_from - $!";
close ($fh_out) or die "$file_to - $!";

View full thread Frage zur Parameterübergabe