in reply to unicode version of readdir

See if problems with extended ascii characters in filenames helps. See graff's response where he says
use Encode; opendir( D, $path ); @datafiles = grep { -f }, readdir( D ); $_ = decode( 'utf8', $_ ) for ( @datafiles );

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re^2: unicode version of readdir
by dk (Chaplain) on Sep 14, 2007 at 20:50 UTC
    No, on win32 unfortunately it doesn't. Win32::readdir substitutes wide characters with '?' if these cannot be mapped to the current locale.
      Good to know -- thanks. (I'm not a Win32 user, so I wouldn't have known.)

      But, do Win32 systems really use locale settings? Would that imply, for instance, that someone using one of the Win32 file systems (NTFS, FAT32 or whatever) could have file names with, say, CP1256 (Arabic) encoding, and someone else use CP1252 (Latin-1), and yet another person use UTF-16LE?

      That would be hell...

      (update: But... in that other thread referenced by zentara, he said that my code snippet worked for him... What's up with that?)

        I use linux.....thats what's up with that. :-) I "assumed" it might work on win32..... well we all know what happens when you assume. ;-)

        I'm not really a human, but I play one on earth. Cogito ergo sum a bum