Windows provides two interface to its functions. One supports single byte characters (Called "ANSI" by MS), and one supports two-byte characters (Called "Wide" or "UNICODE" by MS, they are encoded as "UCS-2le"). For example, to create/open a file, one would call CreateFileA if we passed a single-byte char string, or CreateFileW if we passed a UCS-2le char string.

I'm not sure how about all the details, but one thing in sure. If Perl is using CreateFileA (and I think it does), you have a problem.

>perl -e"use Encode; print encode('UCS-2le', 'ABC')" | od -c 0000000 A \0 B \0 C \0 0000006

Since CreateFileA accepts a NUL terminated file name, it will think encode('UCS-2le', 'ABC') is just 'A'. CreateFileW must be used to open that file. For the same reason, FindFirstFileW and FindNextFileW must be used list the contents of the directory.

I don't know if there's anything "out there" that does what you need. Win32::API will definitely get you there, but you'll have to do some leg work.


In reply to Re: Can't Find File When Non-ASCII Letters Appear in Path by ikegami
in thread Can't Find File When Non-ASCII Letters Appear in Path by emav

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.