I have a file located in a directory with Danish characters in it on a computer running Windows XP. I am using Strawberry perl and would like to read this file. The following code works fine:
use Win32::Unicode::File;
$fname = $mw -> getOpenFile(-filetypes=>$types);
my $fh = Win32::Unicode::File->new;
$fh->open('<', $fname);
The getOpenFile procedure comes from Tk. Now, for some reason, Win32 :: Unicode :: File has some adverse side effects that I can't live with (it eats my memory, see "Not enough memory" with a simple Win32 :: Unicode :: File Reading and Strawberry Loop Perl ). Now, if I try to open a file without the Win32 :: Unicode :: File interface, I get a file not found. The reason for this is because the path is misinterpreted. I tried converting the path according to Perl: managing path encodings on Windows , which for some reason does not work. How do i solve this? I tried the following:
use Encode;
$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 do not understand.
Regards, Michael