有没有办法解决 Perl Tk 中代码点过高的问题?
下面的代码演示了我的问题。运行它会给出错误消息:“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 = "
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.