Khariton has asked for the wisdom of the Perl Monks concerning the following question:

I use Perl and Tk module on Kubuntu 10.10beta with Unicode.
If I insert in my code line
use utf8;
then I can see Unicode symbols in TK GUI.
But in getOpenFile window(where shows files and folders) unicode symbols(ukrainian as example) shows as broken symbols(it's shows like 2*length Europian symbols with umlauts)). I can select this files and folders but can't see it correctly.
If I add
use encoding "uk_UA.UTF-8";
Then I can see folders correctly but can't select unicode files or folders.
I have this problem only in window where shows file structure.
I use program "widget" from TK-demo and all procedures which show file-structure of disk has this bug.
I use ext2 partition with defaults options in fstab for this partition and LANG=uk_UA.UTF-8.
I mean problem in double encoding filenames in Unicode.
How I can overcome this problem? May be I can use another procedures for dialogs?

Replies are listed 'Best First'.
Re: Perl TK getOpenFile and Unicode
by zentara (Cardinal) on Sep 24, 2010 at 15:37 UTC
    Well ain't this my lucky day!? I get to promote my very own module CanvasDirTree. In which I emulate Gtk2's cool animated treeview widget on a Tk canvas. You can assign callbacks to the canvas elements, so you can essentially read any directory with straight Perl code ( which gets it's unicode right). A couple of demos show how to use it.

    As far as the Tk unicode problem you describe, it may have something to do with whether your system's terminals are set to display unicode? I can't swim well in unicode waters yet, I trust the system is setup correctly. :-)

    You might want to look at Tk Characters or wait for unicode master graff to answer this.

    PS. There is an old trick to put in your script:

    $Tk::encodeFallback=1

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

      "Well ain't this my lucky day!? I get to promote my very own module "

      You'll be Rating it No 1 next!