my $enc = 'cp1252'; open my $IN, "<:encoding($enc)", 'input.txt' or die $!; open my $OUT, '>:utf8', 'output.txt' or die $!; print $OUT $_ while <$IN>; close $OUT;