#!/usr/bin/perl use strict; use warnings; use Encode qw(decode encode_utf8); my $testtext = 'öäüÖÄÜ߀'; my $data = encode_utf8 decode "windows-1252", $testtext; open my $fh, '>', "test.txt" or die $!; print $fh $data; close($fh);