I have a file located in a directory, with danish characters in it, on a Windows XP machine. I use Strawberry perl and would like to read this file. The following code works fine:
use Win32::Unicode::File;
# Some code left out....
$fname = $mw -> getOpenFile(-filetypes=>$types);
my $fh = Win32::Unicode::File->new;
$fh->open('<', $fname);
The getOpenFile routine comes from Tk. Now for some reason Win32::Unicode::File has some unfortunate side effects that I cannot live with (it eats my memory, see "Out of memory" with simple Win32::Unicode::File readline loop and Strawberry Perl). Now if I try to open the file without the Win32::Unicode::File interface I get a file not found. The reason for this is that the path gets intepreted incorrectly. I have tried converting the path according to Perl: managing path encodings on Windows which doesn't work for some reason. How should I solve this? I have tried the following:
use Encode;
# Some code left out....
$fname = $mw -> getOpenFile(-filetypes=>$types);
my $fh;
open($fh, '<', encode("utf8",$fname,Encode::FB_CROAK));
and it does not work. Any ideas?
Please forgive me if I am unclear.
Kind regards, Michael