in reply to Handling windoze filenames with odd charactters
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Handling windoze filenames with odd charactters
by Anonymous Monk on Feb 21, 2011 at 02:33 UTC | |
by chrestomanci (Priest) on Feb 21, 2011 at 10:41 UTC | |
by Anonymous Monk on Feb 21, 2011 at 10:57 UTC | |
by Anonymous Monk on Feb 21, 2011 at 10:59 UTC |