# i added use Encoding qw(encode decode); # and in sub foo i decoded the things from File::Find. eg sub foo { $file_name = decode("UTF-8", $_); } # cheers! #### # basically i want to go through a directory with File::Find # and print the (non-asciian) filenames to a file. # let's go through it incrementally, basic assumptions use utf; use File::Find; open (OUT, '>:encoding(UTF-8)', '/tmp/tmp.sql'); open (IN, '<:encoding(ISO-8859-15)',$file_name); sub foo { print "$_\n"; print OUT "$_\n"; # the IN file is used, but none of it's contents are # written to the out file, only the filename $_ is # needed in the OUT file } # when i now execute find(\&foo, $mydir); # it will print fine to the terminal (i use GNU/Debian) # but mojibake to the file # if i prepend this binmode( STDOUT, ':encoding(UTF-8)' ) or die $!; binmode( STDIN, ':encoding(UTF-8)' ) or die $!; # to the script # then it prints mojibake both to terminal and to file # it would be more logical if the other way around