Here's another way for that test snippet to work (knowing that 25105. == 0x6211):
#!/usr/bin/perl -w use Tk; use strict; my ($mw, $test_string, $txt); $mw = MainWindow->new(-title => "UTF-8 Test", -width=>400, -height=>30 +0); $test_string = "This is a sample Chinese character: \x{6211}"; $txt = $mw->Text(-height=>5)->pack; $txt->insert('end', $test_string); MainLoop;
Works for me, no problem -- I see a Chinese character. In fact, I distinctly remember that whenever I've installed Tk for perl 5.8, the "make test" phase spends a fair bit of time going through all the unicode characters (including the Chinese, Japanese and Korean).

I don't think Tk can do Arabic (or any other right-to-left writing system), and I don't know how well it can do with Devanagari or similar Indic scripts, but all the left-to-right characters work fine.

So if this little test snippet isn't working for you, there might be a problem with your particular installation of the Tk bundle (or maybe it's a font issue?)

If this test snippet works, but you're still having trouble getting stuff from mysql to display correctly (even though you seem to be decoding it as you should, or have "utf8_enabled" in the DBI connection), then you may want to check other modes of access to the DB, to see if the actual content in your tables is not what you expect.


In reply to Re^2: Perl/Tk: utf8 in Text widget? by graff
in thread Perl/Tk: utf8 in Text widget? by Marais

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.