Unicode 中为什么会有重复的字符?

发布于 2024-08-11 03:51:13 字数 150 浏览 5 评论 0原文

我可以在 Unicode 中看到一些重复的字符。例如,字符“C”可以由代码点 U+0043 和 U+0421 表示。为什么会这样呢?

I can see some duplicate characters in Unicode. For example, the character 'C' can be represented by the code points U+0043 and U+0421. Why is this so?

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

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

发布评论

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

评论(5

浪漫人生路 2024-08-18 03:51:13

正如其他人所指出的,您在这里的主要谬误是混淆了拉丁文和西里尔文脚本以及其中的一些字形(即 C (U+0043 拉丁文大写字母 C) 和 С (U+0421 西里尔大写字母 ES))。有很多这样的字符对,看起来很相似,但实际上是不同的字符。例如,您会发现很多拉丁文、希腊文和西里尔文。但大多数时候它们只能以大写或小写形式工作。

然而,事实上存在重复,有时是故意的。例如,整个 (ASCII) 拉丁字母在 U+FF00 和 U+FFEF 之间的“半角和全角形式”Unicode 块中再次表示两次。不过,还有其他这样的例子,最引人注目的是在平面 1 上的数学字母部分,其中还存在三个或四个拉丁字母。

还有其他一些东西实际上是相同的字符,但代码点不同。例如,有 µ (U+00B5 微符号)和 μ(U+03BC 希腊小写字母 MU)。这些通常通过分解链接。

Unicode 处理一个称为代码点的抽象概念。代码点明确定义了字符及其脚本或组。它没有说明字体中相应的字形如何呈现(对于拉丁语来说可能已经有很大不同)。它还没有定义如何在文件或内存中表示该代码点(即作为字节序列)。这是 Unicode 转换格式之一的工作。

为什么在具有不同代码点的两种语言中具有相似的字符?

Unicode 的要点是:

  • 与以前存在的所有字符编码兼容。这必须确保编码中使用的每个字符与 Unicode 代码点的直接等效项存在一对一的映射。
  • 忠实、准确地代表当今使用的每个脚本,后来扩展到正在使用并需要存储在计算机系统中的其他脚本。

因此,有非常强烈的动机将脚本分开,并且尝试根据角色的外观来映射角色。无论如何,外观可能很棘手。以西里尔字母“т”为例,它在这里看起来像一个较小的大写拉丁文“T”。然而,斜体的通常呈现方式是:'т' 看起来像小写的拉丁语“m”。你真的不想通过外表来映射这些角色。

As others have noted, your main fallacy here is confusing the Latin and Cyrillic scripts and some glyphs therein (namely C (U+0043 LATIN CAPITAL LETTER C) and С (U+0421 CYRILLIC CAPITAL LETTER ES) ). There are many such character pairs that look alike but are different characters. You will find plenty among Latin, Greek and Cyrillic, for example. Most of the time they only work in either uppercase or lowercase, though.

However, there are in fact duplicates, sometimes intentionally so. For example, the entire (ASCII) Latin alphabet is represented twice again in the 'Halfwidth and Fullwidth Forms' Unicode block between U+FF00 and U+FFEF. There are other such examples, though, most notably in the mathematical alphabet section on Plane 1 where there are three or four more Latin alphabets present.

There are other things that are in fact the same character but at different code points. For example, there is µ (U+00B5 MICRO SIGN) and μ (U+03BC GREEK SMALL LETTER MU). Those are usually linked by decomposition.

Unicode deals with an abstract concept called code point. The code point unambiguously defines a character and its script or group. It says nothing about how the corresponding glyph in a font would be rendered (which may vary wildly for Latin already). It also does not define how this code point is represented in a file or memory (i.e. as a byte sequence). That's a job for one of the Unicode Transformation Formats.

What is reason to have a similar looking character in two languages with different code points?

The main points of Unicode here are:

  • Compatibility to every previously existing character encoding. This has to ensure that there are one-to-one mappings for every character that was used in an encoding to a direct equivalent as a Unicode code point.
  • Faithfully and accurately represent every script that is used nowadays, later expanded to other scripts that were in use and need to be stored in computer systems.

So there is a very strong incentive to keep scripts separate and not try to map characters according to their appearance. Appearance can be tricky anyway. Take for example the Cyrillic letter 'т', which appears like a smaller upper-case Latin 'T' here. However, the usual way it is rendered when italicized: 'т' looks like a lower-case Latin 'm'. You really don't want to map such characters by appearance.

旧话新听 2024-08-18 03:51:13

如果您查看U+0400 到 U+04FF 代码表,您会你会发现U+0421是一个西里尔大写字母“es”。它可能看起来像拉丁C,但它是一个不同的逻辑字符。

If you look at the U+0400 to U+04FF code chart you'll find that U+0421 is a Cyrillic capital leter "es". It may look like a Latin C, but it's a different logical character.

拥醉 2024-08-18 03:51:13

这些字母看起来很相似,但差别很大。 U+0043 是拉丁字母 C,但 U+0421 是西里尔字母 С(对应拉丁字母中的 S)。

由于它们的含义不相关,因此需要单独的代码点来防止大小写和排序算法严重上下文敏感 - 您突然必须猜测您正在处理的是什么语言。

The letters LOOK the same, but are very different. U+0043 is the latin letter C, but U+0421 is cyrillic С (which corresponds to an S in the latin alphabet).

Because of their unrelated meanings, separate code points are required to prevent casing and sorting algorithms from being horribly context-sensitive - you would suddenly have to guess what language you were dealing with.

挽袖吟 2024-08-18 03:51:13

出于同样的原因,0O 看起来相同(在大多数等宽字体中),但编码不同 - 它们意味着不同的东西。

For the same reason that 0 and O look the same (in most mono-spaced fonts), but are encoded differently - they mean different things.

ゃ懵逼小萝莉 2024-08-18 03:51:13

U+0043C 的拉丁语表示形式,而 U+0421 是西里尔字母,这意味着它们实际上不是同一个字母,尽管看起来可能是一样的。

U+0043 is the Latin representation of C, while U+0421 is the Cyrillic, meaning they are not actually the same letter, even though the might look the same.

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