|Just another Perl shrine|
rename to UTF8 filenameby exilepanda (Monk)
|on Jul 30, 2012 at 04:20 UTC||Need Help??|
exilepanda has asked for the
wisdom of the Perl Monks concerning the following question:
I have a task to do file renaming Step 1. Open and Read an Excel file, there are 2 col. First is ID, and second is Name
Step 2. Read into a specified folder, and there are files which name is identical can found in the ID col from Excel
Step 3. Rename the file from ID to the paired name in the Excel file.
Problem. The files name turn into monster character when there are chars out from ANSI.
Since I am reading the names from Excel, so I assumed the source(text of name) is sure UTF-8. Anyway the rename() part is not done correctly.
I had a little study. And I tried Win32API::File::MoveFile() and Win32::Unicode::File::moveW() but without success. I had also tried to create a batch file and run it in cmd, still not success.
My questions come into 2 parts:
2. What can be done to do a correct rename?
Thanks in advance