|Welcome to the Monastery|
how to read unicode filenameby uva (Sexton)
|on Mar 13, 2006 at 11:55 UTC||Need Help??|
uva has asked for the
wisdom of the Perl Monks concerning the following question:
I'm trying to figure out if I can handle Unicode filenames on Windows using Perl 5.8.7 for MSWin32-x86-multi-thread , and if so, how.
I'm running on Windows 2000 (English language setup), and I have a directory full of files with all sorts of characters in their names. Windows Explorer displays them all very nicely.
in this link i have given the screen shots shown in windows explorer
But when I use readdir() to list them, I find that each of the chinese characters get replaced with a "?", so then, of course, I can't do anything with the filenames returned (like open them).
the results for my program is shown in this link
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.