Perl TK Unicode (utf-8) / Windows??

From: TJackson@ndsamericas.com
Date: Wed May 01 2002 - 19:26:11 EDT


Hello- I was wondering if anyone has successfully displayed utf-8 unicode
characters from a Perl Tk app on windows?
There are many examples out there that deal with "charset" and other web
based applications, however this is a stand alone application. At this
point I think that I have tried just about everything, and I'm in need of
help from you unicode gurus on this "Unicode" mailing list.

I understand that Perl Tk is not actually aware of the unicode text so I was
told to convert it like so using "XML::UM".
I also downloaded several fonts without any real success.

use XML::UM;
...
sub getChinese {
        my $ChineseFH = new IO::File('C:\chinese.xml');
             my $c_content = XMLin($ChineseFH);
        
        # create the encoding routine (only once!)
        my $encode= XML::UM::get_encode(Encoding => 'big5',
                                EncodeUnmapped =>
\&XML::UM::encode_unmapped_dec
                               );

        # convert $utf8_string to big5

              my $c1 = "$c_content->{headline}->[0]->{text}";
        my $encoded_string1 = $encode->($c1);
      

        my @chinesecontent;
        push(@chinesecontent, $encoded_string1);
        return @chinesecontent;
}

  my @chinese_content = &getChinese();
  my $text = $rightFrame->Text(-height => 8, -font => 'hanzi-kaishu' )->pack
(-side => 'top');

  $text->tagConfigure('bold', -font => "hanzi-kaishu 8");
  $text->insert('end', "$chinese_content[0]\n", bold);

It appears that the utf-8 is converted (i think) , but I still see garbage
characters on the screen? Can anyone help me out in this matter.

Thanks in advance!
Tom Jackson



This archive was generated by hypermail 2.1.2 : Wed May 01 2002 - 20:24:38 EDT