在 Smalltalk 实现中测试 Unicode 支持的正确方法是什么?
考虑到任何 Smalltalk 风格,我应该如何继续检查 Unicode 是否受支持?如果没有支持,我如何检测缺少哪个级别(VM、字体、转换器等)?
Given any Smalltalk flavor, how should I proceed to check if Unicode is supported? In case of not having support, how can I detect at which level is missing (VM, font, Converter, etc)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 VM 级别,您可以尝试
Character codePoint: 256
或Character codePoint: 65536
(某些 Smalltalks 可能使用value:
而不是codePoint :仍然)。不同方言之间的转换器 API 也有所不同,但如果 VM 支持 Unicode,转换器也可能会支持。
据我所知,没有 Smalltalk 完全支持 Unicode 算法(大小写折叠、字符属性等),但有些可能支持双向文本。例如,GNU Smalltalk 从 GTK+ 和 Pango 免费获得。
At the VM level you can try
Character codePoint: 256
orCharacter codePoint: 65536
(some Smalltalks may usevalue:
instead ofcodePoint:
still). Converter APIs differ between dialects too, but chances are that if the VM supports Unicode so will the converters.As far as I know, no Smalltalk fully supports Unicode algorithms (case-folding, character properties, etc.), but some may support bidirectional text. For example GNU Smalltalk gets that from free from GTK+ and Pango.
我认为您的意思是手动检查您打算使用的特定口味或口味,因为我认为没有任何自动化方法。我想到了两件事。首先,阅读文档。其次,尝试在窗口中输入一些带有任意 unicode 字符的文本,看看它们是否显示。如果他们这样做了,你就没事了。如果他们不这样做,那么这是一个有趣的问题,问题是否可能与输入、特定平台上可用的字体、表示字符的基本能力或其他方面有关。您还可以尝试查找用于处理特定编码的 API(支持 Unicode 是一个相当模糊的术语),并尝试读取和写入包含其中一些字符的文件。或者您可以询问某人您感兴趣的特定口味是否支持您想要使用的特定功能。
对于 VisualWorks 来说,答案可能是肯定的,但这具体取决于您想要做什么。例如,可以显示从右到左语言的字符,但使用它们进行文本编辑效果不太好。
I presume you mean to check manually for a particular flavor or flavors you intend to use, because I don't think there's any automated way. Two things spring to mind. First, read the documentation. Second, try typing some text with arbitrary unicode characters into a window and see if they display. If they do, you're fine. If they don't, then it's an interesting question whether the problem might be with input, fonts available on a particular platform, basic ability to represent the characters, or something else. You could also try looking up the APIs for working with particular encodings (Supports Unicode is a rather vague term) and try reading and writing a file containing some of these characters. Or you could ask somebody if the particular flavor you're interested in supports the particular features you want to use.
For VisualWorks the answer is probably yes, but it will depend on exactly what it is you want to do. For example, characters from right-to-left languages can be displayed, but text editing with them is not going to work very well.