有没有办法解决 Perl Tk 中代码点过高的问题?

发布于 2024-10-13 08:35:12 字数 308 浏览 1 评论 0 原文

下面的代码演示了我的问题。运行它会给出错误消息:“UCS-2LE:代码点“\x{20541}”在 C:/Perl/site/lib/Tk/Widget.pm 第 205 行太高。在 E:\test。 pl 线 9"。

我的 Tk 版本是 804.028,我在 WinXP(简体中文版)上运行 ActivePerl 10.0.0。

有谁知道是否有办法解决它?一如既往地感谢:)

use strict;use warnings;
use utf8;
use Tk;

my $mw = MainWindow->new;
my $text = "
              

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;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤凫 2024-10-20 08:35:12

Tk 目前不支持基本多语言平面之外的 Unicode 字符(即,最多 U+00FFFF)。虽然有计划解决这个问题,但它需要更改 Tk 代码中的很多内容(因为必须完成新的字符串管理层才能使事情变得高效,而且还需要真正解决规范化问题)所以它的工作并没有那么匆忙。我确信,如果有人愿意提供帮助来解决这个问题,我们将受到欢迎。

但是,如果您认为您的角色不应该位于 BMP 之外(抱歉,我无法从您的问题中看出),那么您的代码中就会出现其他一些编码问题。诊断此问题的一种方法是从 Unicode 图表 中获取值,因为它们非常完整且明确然后我们就可以确保我们正在谈论的是同一件事。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文