getSaveFile appears to return the file name as decoded text. CreateDirectory expects decoded text according to the documentation, so that's good. As for open, it (more or less) expects text encoded using the current locale (unix) or ANSI code page (Windows). GetANSIPathName is there to do that conversion.

I was trying to use chcp to figure out what's your code page, but it returns the OEM code page. We're interested in the ANSI one. Your ANSI code page is probably cp1252 (a superset of iso-8859-1).

The output you gave shows that .../ü/test.txt gets properly encoded to cp1252, so everything is fine on the encoding side.

The output you gave also shows that you are trying to create file .../Desktop/ü/test.txt/test.txt since you append test.txt to the displayed value. (Note the double "test.txt".) I'm guessing directory .../Desktop/ü/test.txt doesn't exist (though I don't know why CreateDirectory didn't given an error when it didn't create it).

The problem is that you're using the file path as the directory path. That's why it's always a good idea to include the file name in error messages for open.


In reply to Re^3: path encoding folder by ikegami
in thread path encoding folder by fanticla

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.