C 标准库中多字节字符的显示宽度——数据库的准确性如何?
Display-width of multibyte character in C standard library – how accurate is the database?
标准 C 库 returns 2
对亚洲字符的 wcwidth
调用。然后是 Unicode 符号,如箭头。对于那些 returns 1
。通常情况下字符比单列宽,但库并没有错,因为终端在单列打印它们并允许视觉重叠,有时会给出不错的结果,比如 ndash "–".
有明显受苦的人物吗?我想知道亚洲人和其他地区的人如何使用终端,他们开发了哪些解决方案。例如,显示跨越整行并包含当前目录名称的 shell 提示可能是一个严重的问题。可以wcwidth
打补丁以获得更好的效果吗?例如,使用 github/wcwidth.c 作为起点。
与多义字符有区别。 xterm 有 Markus Kuhn 的 original (the link you show appears to be his, with the comment-header removed), as well as an alternate version with adjustments to accommodate CJK (East Asian). Besides that, it checks at startup for usable system locale tables。有些已经足够好了;其他人不是。没有人对什么是真正的好进行过系统的(无偏见的)调查(您可能会看到关于这方面的一些意见,作为答案提供)。
标准 C 库 returns 2
对亚洲字符的 wcwidth
调用。然后是 Unicode 符号,如箭头。对于那些 returns 1
。通常情况下字符比单列宽,但库并没有错,因为终端在单列打印它们并允许视觉重叠,有时会给出不错的结果,比如 ndash "–".
有明显受苦的人物吗?我想知道亚洲人和其他地区的人如何使用终端,他们开发了哪些解决方案。例如,显示跨越整行并包含当前目录名称的 shell 提示可能是一个严重的问题。可以wcwidth
打补丁以获得更好的效果吗?例如,使用 github/wcwidth.c 作为起点。
与多义字符有区别。 xterm 有 Markus Kuhn 的 original (the link you show appears to be his, with the comment-header removed), as well as an alternate version with adjustments to accommodate CJK (East Asian). Besides that, it checks at startup for usable system locale tables。有些已经足够好了;其他人不是。没有人对什么是真正的好进行过系统的(无偏见的)调查(您可能会看到关于这方面的一些意见,作为答案提供)。