Ok, found this this which works for readdir functionality.

use Win32::OLE qw(in); use Encode; Win32::OLE->Option(CP => Win32::OLE::CP_UTF8); #Input: -dir to read files from #Output: -array ref with files sub ReadDirWithWin32OLE { my $dir = shift; #backslashes only in dir $dir=~s-\/-\\-g; #remove last backslash $dir=~s-\\\s*$--; if (not -e $dir) { warn "dir ($dir) does not exist"; return; } my $fso = Win32::OLE->new("Scripting.FileSystemObject"); #won't work if $dir contains unicode chars :( my $folder = $fso->GetFolder($dir); if (!$folder) { warn "Problem creating Win32::OLE (folder) object"; return; } my @filesFound = (); foreach my $file (in $folder->Files) { my $shortFilename = $file->ShortName; #my $shortFilename = $file->Name; $shortFilename = $dir . "\\" . $shortFilename; if (-e $shortFilename) { print "\nFile Found", $shortFilename; push @filesFound, $shortFilename; } else { print "\nFILE NOT FOUND!! (this should not happen):", $sho +rtFilename; } } return \@filesFound; }
Filenames examples:
file1_刚形变.txt
file2_ מדהימה .txt

BUT...:
1)If directory path ($dir) contains weird unicode chars it won't work?!
2)We're forced to use short filenames?! The Win32API::File trick, as mentioned by Corion, used here, didn't seem to work with "weird file2" (see above)?!
3)Still no way to open specific files with unicode chars if drag and dropped into a perl/tk window (but that is maybe whole different topic?).

@graff:
readdir gives us the ? char (ascii 63) instead of *any* weird unicode char.


In reply to Re^2: Opening files with japanese/chinese chars in filename by Anonymous Monk
in thread Opening files with japanese/chinese chars in filename by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.