in reply to Can't Find File When Non-ASCII Letters Appear in Path
Windows provides two interface to its functions. One supports single byte characters (Called "ANSI" by MS), and one supports two-byte characters (Called "Wide" or "UNICODE" by MS, they are encoded as "UCS-2le"). For example, to create/open a file, one would call CreateFileA if we passed a single-byte char string, or CreateFileW if we passed a UCS-2le char string.
I'm not sure how about all the details, but one thing in sure. If Perl is using CreateFileA (and I think it does), you have a problem.
>perl -e"use Encode; print encode('UCS-2le', 'ABC')" | od -c 0000000 A \0 B \0 C \0 0000006
Since CreateFileA accepts a NUL terminated file name, it will think encode('UCS-2le', 'ABC') is just 'A'. CreateFileW must be used to open that file. For the same reason, FindFirstFileW and FindNextFileW must be used list the contents of the directory.
I don't know if there's anything "out there" that does what you need. Win32::API will definitely get you there, but you'll have to do some leg work.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can't Find File When Non-ASCII Letters Appear in Path
by emav (Pilgrim) on Apr 16, 2007 at 20:26 UTC |