ANSI 字符集中未使用的字符
我正在开发一种小型编程语言和 IDE。
ANSI 字符集规定了未使用字符的子集。这是完整的列表:0x7F、0x81、0x8D、0x8F、0x90、0x9D
我想将其中一些用于不可见的代码标记,所以我想知道它们是如何在不同的环境中打印的。我是否可以假设它们始终是空格,或者某些编辑器会荣幸地将它们替换为“?”之类的内容还是灰色矩形?
谢谢你,德米特里
I'am developing a small programming language together with an IDE.
The ANSI character set states the subset of unused characters. Here is the complete list: 0x7F, 0x81, 0x8D, 0x8F, 0x90, 0x9D
I'd like to use some of them for an invisible code markup, so am wondering how they got printed in different environments. Can I assume they are always a whitespace, or some editors will take the honor to replace them with something like '?' or grey rectangle?
Thank you, Dmitry
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您似乎在谈论 Windows-1252,它只是众多“ANSI”之一Windows 可以使用的代码页,并且可能不在 Windows 之外使用。不要将新产品与过时的技术捆绑在一起。对于编程语言来说,不支持 Unicode(无论是 UTF-16le 还是 UTF-8)是不可接受的。
虽然回答直接问题相当没有意义,但答案是否定的,您不能假设它们将被视为空格。有些可能。有些可能会替换为空格。有些可能会替换为另一个字形。有些可能会使用特殊的颜色。有些可能会发出警告。有些可能无法加载文件。
顺便说一句,如果您指的是 Windows-1252,则只有 0x81、0x8D、0x8F、0x90、0x9D 未分配。
You seem to be talking about Windows-1252, which is just one of many "ANSI" code pages Windows can use, and it's probably not used outside of Windows. Don't tie a new product to an obsolete technology. Not supporting Unicode (be it UTF-16le or UTF-8) is unacceptable for a programming language.
While it's rather moot to answer the direct question, the answer is no, you cannot assume they will be treated as whitespace. Some may. Some may replace with a space. Some may replace with another glyph. Some may use special colours. Some may give a warning. Some may not load the file.
By the way, if you are referring to Windows-1252, only 0x81, 0x8D, 0x8F, 0x90, 0x9D aren't assigned.
您不应该假设任何特定的行为,因为它将取决于显示小部件,并且很可能取决于字体。预处理要显示的文本或使用带外标记机制(例如,许多文本字段小部件允许您将属性附加到文本串)。
You shouldn't assume any specific behavior, as it will depend on the display widget and quite possibly on the font. Either preprocess the text for display or use an out-of-band markup mechanism (for example, many text field widgets let you attach attributes to runs of text).