I would like to open an excel file on Cygwin that have a ü
in the filename but I get an exception:
OLE exception from "microsoft Office Excel":
Here's the program I am using:
use 5.014;
use warnings;
use strict;
use Win32::OLE qw(CP_UTF8);
use Win32::OLE::Const 'Microsoft Excel';
use Win32::OLE::Enum;
$Win32::OLE::Warn = 2;
$Win32::OLE::CP = CP_UTF8;
my $excel = Win32::OLE->new('Excel.Application', sub {$_[0]->Quit;});
my $filename = "/cygpath/c/fooü.xls";
$filename = `cygpath -wa '$filename'` or say "Damned";
my $book = $excel->Workbooks->Open({ FileName => $filename, ReadOnly => 1}) or return;
What can I do to properly encode the filename? I already tried encode('utf8', $filename)
as well as cp1252
and latin1
.