in reply to Perl/Tk: utf8 in Text widget?
#!/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: 我'; $txt = $mw->Text(-height=>5)->pack; $txt->insert('end', $test_string); MainLoop;
The entity in the code above was inserted by the PerlMonks web site. In my original source code I have a Chinese character. If anyone wants to try out this issue, you'll have to somehow get a Unicode character into the string.
--- Marais
and it also works with the original Chinese character if I include$test_string = 'This is a sample Chinese character: ' . chr(25105);
use utf8;
So clearly I have to give this some more thought. It's looking as if a string retrieved from the database must be different in some important way from a constant string. Gack.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl/Tk: utf8 in Text widget?
by graff (Chancellor) on Sep 25, 2009 at 01:39 UTC |