Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Win32 API directory searches that return wide / unicode filenames

by dsully (Acolyte)
on Mar 03, 2006 at 17:01 UTC ( #534282=note: print w/ replies, xml ) Need Help??


in reply to Win32 API directory searches that return wide / unicode filenames

Last December, I brought this problem up on p5p:

http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2005-12/msg00259.html

No one had any good solution for it.

Ideally, perl/win32.* will be updated by someone (or by me) to support the Wide functionality. It's rather a huge shortcoming, when standard tools like File::Find and opendir() won't work at all. It's hard to write cross platform code that way when Win32 _Perl_ is fundamentally broken wrt Unicode filenames.


Comment on Re: Win32 API directory searches that return wide / unicode filenames
Replies are listed 'Best First'.
Re^2: Win32 API directory searches that return wide / unicode filenames
by BrowserUk (Pope) on Mar 03, 2006 at 17:35 UTC
    Ideally, perl/win32.* will be updated by someone (or by me) to support the Wide functionality.

    (Some/All?) the code to support this option is still there from when the -C command line option enabled the use of the wide apis on win32.

    # Win32.c:775-782 /* do the FindFirstFile call */ if (USING_WIDE()) { A2WHELPER(scanname, wbuffer, sizeof(wbuffer)); fh = FindFirstFileW(PerlDir_mapW(wbuffer), &wFindData); } else { fh = FindFirstFileA(PerlDir_mapA(scanname), &aFindData); } # Win32.c:858-870 if (USING_WIDE()) { res = FindNextFileW(dirp->handle, &wFindData); if (res) { W2AHELPER(wFindData.cFileName, buffer, sizeof(buffer)); ptr = buffer; } } else { res = FindNextFileA(dirp->handle, &aFindData); if (res) ptr = aFindData.cFileName; }

    All that is needed is the addition of code to enable this at runtime in perl.c/S_parse_body() where it presumably used to live. I can't see any signs of it there now.

    Of course, it might be much harder to persuade the powers that be to allocate a new switch letter for the purpose. Maybe additional values could be added to the new interpretation of the -C switch (See perlrun).

    Say 'W'/128 for Wide calls. Ie. perl -CW script.pl would do what -C used to do?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      FYI - all the if (USING_WIDE()) calls were removed by a patch from Jan back in November in bleadperl.

      So that's really not the route to go.

      I'm not entirely sure why the A functions are the default instead of W.

        That seems a shame, but if Jan is Jan Dubois, he probably had good reasons?


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://534282]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2015-07-08 05:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls