> I'm trying to figure out if I can handle Unicode filenames on 
> Windows using Perl 5.8.4, and if so, how.

[...]
 
> So my question is: How can I deal with these files?
> 
> I've tried using Perl scalars containing UTF-8, UTF-16LE and 
> UTF-16BE encodings of the filenames, but none of them work 
> either.  Indeed, if I try to write a new file with a name 
> constructed in those ways, then the name of the file actually 
> created is simply the sequence of bytes that make up those encodings.

I don't think this is possible from Perl code right now.  You need to
call CreateFileW() to open a file with a Unicode name.  If you want to
hack something, then I would suggest to write a little XS module that
just swaps out the file handle in a PerlIO* structure.  Look at
PerlIOWin32_open() in win32/win32io.c to see how Perl currently opens
a file.

Another quick-and-dirty "solution" would be to build a custom Perl
by hacking win32/win32.h.  If you change the USING_WIDE definition
to "1" then you end up with a version of Perl that has the old "-C"
behavior hardcoded.  Remember that this is not really compatible with
Perl's Unicode handling.

Cheers,
-Jan


Reply via email to