The following code demonstrates my problem. Running it gives me the error message that reads:”UCS-2LE:code point “\x{20541}” too high at C:/Perl/site/lib/Tk/Widget.pm line 205. at E:\test.pl line 9″.
my Tk version is 804.028 and I’m running ActivePerl 10.0.0 on WinXP (Simplified Chinese version).
Does anyone know if there’s a way around it? Thanks like always 🙂
use strict;use warnings;
use utf8;
use Tk;
my $mw = MainWindow->new;
my $text = ""; #A Chinese character
eval{
$mw->Label(-text => $text)->pack;
};
warn $@ if $@;
MainLoop;
Tk doesn’t currently support Unicode characters outside the Basic Multilingual Plane (i.e., up to U+00FFFF). While there is a plan to fix this, it requires changing a great many things inside the Tk code (because a new string management layer has to be done in order for things to be efficient, plus there’s a need to really sort out the normalization) so it’s not being worked on in a great hurry. I’m sure that if someone were to offer assistance with sorting this out, it would be welcome.
However, if you think your character should not be outside the BMP (I can’t tell from your question, sorry to say) then you’ve got some other encoding problem in your code. One way to diagnose this is to get the value from the Unicode charts since they’re properly complete and definitive and we can then make sure that what we’re talking about is the same thing.