Hi all,
Using File::Find or readdir, I ran into a file that was returned, but could not
be opened or verified as a real file. I have been seeking a solution to this
problem for a few days with not much luck. Here is the file name with an
unusual character in "Truby".
09 - Rainer Trüby Trio - Donaueschingen.wma
I first tried this running like perl -w in a console window:
use File::Find;
use Encoding;
File::Find::find sub {
unless ( -d || -f ) {
my $enc = guess_encoding( $_ );
if ( ! ref( $enc )) {
warn "guess_encoding failed on $_\n";
}
warn "Guessed ".$enc->name."\n";
print $File::Find::name, "\n";
print $File::Find::dir, "\n";
print $_, "\n";
}
}, 'F:\test';
And the encoding guessed was ascii, and the above filename printed out without
the (umlat?) character. I then tried to use readdir directly and various use of
Encode/Decode along with POSIX::open. No luck. My last try was based on a
newsgroup post I saw that suggested a DOS character set problem:
my $some_dir = "F:\\test";
open (FH, "dir /B $some_dir |") or die "unable to do dir $!";
while ( <FH> ) {
chomp;
my $file = "$some_dir\\$_";
unless ( -f $file || -e $file ) {
# 09 - Rainer Tr?by Trio - Donaueschingen.wma
qx( copy "$file" "$_" );
print "DNE: ";
}
print "$_\n";
}
The file prints out with a question mark in place of the special character.
Data::Dumper shows the same. It still fails type and existence check, but.. I
can successfully copy the file using the same returned file name that failed
the existence check!
I'm really lost on this one.
Anyone know something about this? I have an unknown number of files in this
condition and the music library is extremely large.
Thanks for your time,
Richard
========
Platform - Windows XP
perl5 (revision 5 version 8 subversion 6)
osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
useperlio=define
Locally applied patches:
ActivePerl Build 811
21540 Fix backward-compatibility issues in if.pm
23565 Wrong MANIFEST.SKIP
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs