Encoding issues are notoriously tricky — in particular when filenames are involved.  And with the info you've provided it's not exactly easy to come up with a do-that-and-you'll-be-happy recipe solution :)

The first step when debugging encoding problems is to find out what encodings are involved.  In this particular case, it would be important to know the encoding the filesystem uses for filenames. Once you know that, you can decode the filenames on input (coming from the filesystem), and encode them on output from/to the respective encoding being used. Perl's handling of filenames does not involve any fancy auto-conversion magic, it's all plain octets.  (Even on OSses like Windows, where there is a Unicode interface (aka "wide API") for filenames - meaning the OS would take care of converting from/to the system's native encoding - Perl does currently not make use of it.)

OTOH, tk___getOpenFile() might be doing its own thing... (I've never used tkx, so I can't tell). In other words, you'd have to check whether the names for the selected file(s) are still in the same (raw) encoding being used in the filesystem.  To check such questions, it's always a good idea to use hexdumps or, better yet, Devel::Peek (which also informs about the state of Perl's utf8 flag) — simply printing the strings to your terminal, or viewing them in your favorite editor, browser, or some such, might involve implicit encoding conversions, font issues, etc. that all in all will typically only serve to confuse matters even more... (unless you know your tools very well).


In reply to Re: Handling file path with unusual characters by almut
in thread Handling file path with unusual characters by samuelalfred

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.