I would be very surprised if stat or rename has problems with files that contain odd characters. I think it is much more likely that you have a bug in your script, so the filename you are passing to stat is not what you think.
Have you checked that the problem files actually exist. It is possible that the person who prepared the spreadsheet did so by typing in the filenames by hand, and made mistakes. It is also possible that MS Excel's auto correct feature changed the characters, for example by changing a plain hyphen (ASCII 0x45: -) into an em hyphen (Unicode U+2014: —)
Also when you write the substitution: $pdfn =~ s/^\"|\"$//g; I presume that you are looking to remove quotes from the start or the end of the string. I think you need to enclose the ^\" and \"$ clauses in round brackets in order to use the alternation operator, as otherwise it might ignore the anchors on the start and end of the string. In other words the regexp engine will treat that substitution as: /^((\")|(\"))$/ and remove quotes from any part of the $pdfn string. I would write the substitution as: $pdfn =~ s/^\"?(.*)\"?$/$1/g;
In reply to Re: Handling windoze filenames with odd charactters
by chrestomanci
in thread Handling windoze filenames with odd charactters
by cormanaz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |