Windows has two set of system calls: "A"NSI and "W"ide.

Perl's file functions use the "A" version of the system call, so the UTF-8 encoding of the string you pass to them is interpreted as being encoded according to the system's code page (e.g. American systems typically use cp1252, Microsoft's version of iso-latin-1).

One way to achieve your goal is to encode the file name according to the system's code page.

#!/usr/bin/perl use utf8; use Encode qw( encode ); use Win32::Codepage; mkdir encode(Win32::Codepage::get_encoding(), 'Ïntêràtíonaliçzation');

That method assumes the characters you are using are present in your system's code page. If they are not, you will need to use the "W" version of the function. The "W" function accepts UCS-2le strings which can encode common UNICODE characters. Unfortunately, I don't think there currently exists a module that gives access to those functions, but you could access them via Win32::API.


In reply to Re: Mkdir and utf8 by ikegami
in thread Mkdir and utf8 by perlmonkdr

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.