I have a file that is encoded PC UTF-8. I would like to convert the file into PC ANSI.
I have tried the below, but I always get the output file to be PC UTF-8.
use Encode;
$infile = $ARGV[0];
open(INFILE, $infile);
my $outfile = "temp.txt";
open(OUTFILE, ">$outfile");
while(<INFILE>) {
my $row = $_;
chomp $row;
$row = Encode::encode("Windows-1252", $row);
print OUTFILE $row."\n";
}
close INFILE;
close OUTFILE;