Posted on 2008-05-21 16:34:40-07 by vanilla
Tkx UTF8 support on Windows Vista platform
I am running ActivePerl 5.10 on a Windows Vista platform and trying to build a GUI with a Tkx listbox. My utf-8 casted variable ($v) compiles but shows garbage on the screen. As a newbie to Tkx, I am scrambling for a full grammar of the language. Does anyone see what I am missing in my code snippet below to allow my utf-8 strings to display cleanly? What is the best site for a complete listing of the Tkx syntax? Thanks, VanillaGreg
use Unicode::String qw(utf8 latin1 utf16be);
use Tkx; #use strict;
use warnings;
my $mw = Tkx::widget->new(".");
$mw->g_wm_title("GreySon");
$mw->g_wm_minsize(300,200);
$u = utf8("hello1");
$v = utf8("SOMETHING BEYOND ANSI HERE - LIKE RUSSIAN CYRILLIC - THIS CPAN FORUM SITE DOES NOT ALLO +W MY EXAMPLE");
$w = utf8("hello3");
my $lb_value = "....";
my $message = "The $lb_value hen lives in a chicken coop.";
my @colors = ($u, $v, $w);
#my @colors = qw(red yellow orange pink purple);
my $label = $mw->new_label(-textvariable => \$message);
my $enter = $mw->new_label(-text => "Select appropriate word");
my $lb = $mw->new_listbox(-selectmode => "single");
$lb->insert("end", sort @colors);
my $show = $mw->new_button(-text => "Show selection", -command => \&display);
my $exit = $mw->new_button(-text => "Exit", -command => {exit});
$label->g_pack;
$enter->g_pack;
$lb->g_pack;
$show->g_pack;
$exit->g_pack;
Tkx::MainLoop();
sub display {
my @selections = $lb->curselection;
$message = "You selected: ";
foreach (@selections) {$message .= $lb->get($_) . "\n";} }
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.