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

hi
i am using activestate perl 5.10 with perl/tk 804.027 on windows xp
in the following code (just a form with a menu and two submenus:
#!/usr/bin/perl use warnings; use strict; use Tk; use utf8; use encoding 'cp1256'; use Encode qw(encode decode); my $mw = tkinit; my $menubar = $mw->Menu(-type => 'menubar'); $mw->configure(-menu => $menubar); my $text1 = encode( 'utf8','ملف'); #arabic word for file my $text2 = encode( 'utf8','فتح'); # arabic word for open my $text3 = encode( 'utf8','تسجيل'); # arabic word for save my $menu = $menubar->cascade(-label => $text1); $menu->command(-label => $text2); $menu->command(-label => $text3); MainLoop; __END__
the arabic letters in $text2 and $text3 are displayed correctly in arabic, while $text1 is displayed as unicode numbers and not arabic letters ie the label of the main menu is displayed as:
\x{0645}\x{0644}\x{0641}
what should i do?
why the label of a submenu displayed correctly as letters while the label of the main menu displayed as unicode numbers? thanks

Replies are listed 'Best First'.
Re: Perl/TK unicode font problem
by zentara (Cardinal) on Apr 05, 2008 at 15:09 UTC
    Just for your information, your code displays correctly with Tk804.027 on linux, with Perl5..8.8.

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: Perl/TK unicode font problem
by thundergnat (Deacon) on Apr 05, 2008 at 15:47 UTC

    I have run a similar problem in the past and tracked it down to missing glyphs in the font. If the font you are trying to use to display the text doesn't have a glyph defined for a particular codepoint, under Windows, it displays the hex ordinal instead.

      thanks for your suggestion, your suggestion is true, but in my case the behaviour of displaying unicode hexadecimal numbers must be universal and applied to all the components of the form not just the label of a menu, while displayed correctly in submenus also displayed correctly on Labels and on Buttons even i do not specified the font. here is a picture of my case:
      http://img159.imagevenue.com/img.php?image=51043_pic1_122_1022lo.JPG
Re: Perl/TK unicode font problem
by Anonymous Monk on Apr 05, 2008 at 13:26 UTC
    Try Tk-804.028
      just installed tk 804.028.0.0 from
      http://www.bribes.org/perl/ppmdir.html
      the same problem as before
      seems the problem only with windows xp

        Make sure that you've got the required code pages installed and available to Perl/Tk.


        Information about American English usage here and here. Floating point issues? Please read this before posting. — emc