I have a large application that runs as a command line utility, or as GUI. In both cases, the UI just gathers args for a common module that does all the work. The app must run under all flavours of Windows, Linux, and OS-X. It is distributed as executable binaries for all three platforms using ActiveState app builder (with source, see http://itee.uq.edu.au/~chernich/tagsuite.html).

The problem is that when run from the command line, it will correctly process files with extended chars (non English alphabet if you will) in the name/path. When run as a Tk GUI, it won't! (see this post for my initial worries).

In other words, SOMETHING in Tk changes the runtime environment such that the encoding of filepaths, either entered manually, found by readdir, or selected in Tk::getOpenFile are not recognized as valid paths by any common Perl file operation (-f, -d, open, etc)!!

I can pull some tricks to make the filepaths digestable to Linux and OS-X, and some even more diabolical ones to partially address the Windows situation, but this will NEVER be a fix because the problem is so low-level that using Tk::getOpenFile to select files fails internally when trying to open a directory with extended chars in the name. The list box has shown the directory, but when you double-click to enter it, an error dialog is generated by getOpenFile saying the file does not exist.

I know how to fix this, but I'm not about to start hacking Tk as a past-time. It appears to me that there is a fundamental problem with Tk and extended chars in filenames. I also can't believe I'm the first to encounter this, but I can't find any posts on any forums that mention this problem specifically.

If any Monk can point me at something that helps, or suggest a different forum where Perl Tk is might get better coverage, I'd sure appreciate it.

I've not included a demo program due to the difficulty of including/creating the necessary test data, but if anyone is serious about assisting, I'm happy to create a little tar with example code and data.


In reply to Tk causes problems with file paths containing non-Latin-1 chars by ron7

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.