Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
That fails both the easiness test and the simplicity test. It's also not portable programming.

Meh, maybe :D

Is File::Find magically Unicode-capable on operating systems besides Microsoft Windows?...

Yes, in that it "assumes byte strings both as arguments and results", and the underlying operating system calls will happily take and give unicode if they support that. The win32 version specifically uses the ascii version of the system calls (the unicode is called wide system calls), so you get shortnames (its win32 backwards compatibility).

Modern Perl really ought to be able to do file handling stuff well (it does), and it ought to be able to handle Unicode well (it does now), and it ought to be able to do both at once well (it doesn't - not on Windows).

Yeah, Modern Perl really ought to be without bugs too :) See this note from perlunicode

One reason why Perl does not attempt to resolve the role of Unicode in these cases is that the answers are highly dependent on the operating system and the file system(s). For example, whether filenames can be in Unicode, and in exactly what kind of encoding, is not exactly a portable concept. Similarly for the qx and system: how well will the 'command line interface' (and which of them?) handle Unicode?

Does anyone here know: Is File::Find going to be enhanced soon to handle Unicode directory and file names? It's a core module.

*yawn* here is patch

--- Find.pm 2010-06-07 18:03:58.671875000 -0700 +++ Find.pm.new 2010-06-07 18:33:52.109375000 -0700 @@ -6,7 +6,16 @@ our $VERSION = '1.16'; require Exporter; require Cwd; - +BEGIN { eval { + use Win32::Unicode::Native(); ## TODO fix exporting + use subs qw( opendir readdir closedir stat ); + *File::Find::opendir = *Win32::Unicode::Native::opendir ; + *File::Find::readdir = *Win32::Unicode::Native::readdir ; + *File::Find::closedir = *Win32::Unicode::Native::closedir ; + *File::Find::stat = *Win32::Unicode::File::statW; +#~ use subs qw( lstat ); *File::Find::lstat = *Win32::Unicode: +:File::statW; ## bogus , TODO BUG, Can't stat .: No such file or dir +ectory + }; +} # # Modified to ensure sub-directory traversal order is not inverded by + stack # push and pops. That is remains in the same order as in the directo +ry file, @@ -892,13 +901,14 @@ $dir= $dir_name; # $File::Find::dir + my $DIRHANDLE; # Get the list of files in the current directory. - unless (opendir DIR, ($no_chdir ? $dir_name : $File::Find::curren +t_dir)) { + unless (opendir $DIRHANDLE, ($no_chdir ? $dir_name : $File::Find: +:current_dir)) { warnings::warnif "Can't opendir($dir_name): $!\n"; next; } - @filenames = readdir DIR; - closedir(DIR); + @filenames = readdir $DIRHANDLE; + closedir($DIRHANDLE); @filenames = $pre_process->(@filenames) if $pre_process; push @Stack,[$CdLvl,$dir_name,"",-2] if $post_process; @@ -1156,13 +1166,14 @@ $dir = $dir_name; # $File::Find::dir + my $DIRHANDLE; # Get the list of files in the current directory. - unless (opendir DIR, ($no_chdir ? $dir_loc : $File::Find::current +_dir)) { + unless (opendir $DIRHANDLE, ($no_chdir ? $dir_loc : $File::Find:: +current_dir)) { warnings::warnif "Can't opendir($dir_loc): $!\n"; next; } - @filenames = readdir DIR; - closedir(DIR); + @filenames = readdir $DIRHANDLE; + closedir($DIRHANDLE); for my $FN (@filenames) { if ($Is_VMS) {
Seems to work, but needs a test case, and Win32::Unicode::File::stat needs some help.... good luck, I hope you submit a bug report (perlbug) and get this patched quick.

-- Some guy who happened to stop by and tune in for a minute


In reply to Re^5: Is File::Find Unicode-(Conformant|Compliant|Enabled|Capable)? by Anonymous Monk
in thread Is File::Find Unicode-(Conformant|Compliant|Enabled|Capable)? by Jim

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 18:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found