简体   繁体   English

Linux与Windows:控制台如何呈现unicode字符?

[英]Linux vs. Windows: How does the console render unicode characters?

This is quite a low-level (low in the sense of "closer to the metal") question. 这是一个相当低级别(在“接近金属”的意义上较低)的问题。

I was wondering if any of you could point me to documentation, explanations, etc. of how, upon receiving a Unicode character (or any character code, but I'm particularly interested in the Unicode Standard) the console in Windows, good ol' cmd.exe (using, say, codepage 65001) and xterm in Linux started with, say, LC_CTYPE=en_US.UTF-8 look up the corresponding glyph (and where). 我想知道你是否有人能指出我在接收到Unicode字符(或任何字符代码,但我对Unicode标准特别感兴趣)的Windows文件控制台时的文档,解释等等。 cmd.exe(使用,比方说,代码页65001)和Linux中的xterm开始,比方说, LC_CTYPE=en_US.UTF-8查找相应的字形(和where)。

I know it may be harder to know in Windows, but I can't really find much information. 我知道在Windows中可能更难以了解,但我找不到太多信息。

Thank you. 谢谢。

As far as I can tell, cmd.exe is bound to whatever 256-character code page you defined as the "codepage for non-Unicode programs" or whatever it was called. 据我所知,cmd.exe绑定到您定义为“非Unicode程序的代码页”或其他任何调用的256字符代码页。

To elaborate, if I set the above setting to Japanese, cmd.exe suddenly replaces backslashes with yen signs (as does every other non-Unicode app on the system) and correctly interprets ShiftJIS codes, for example. 详细说来,如果我将上面的设置设置为日语,cmd.exe突然用日元符号替换反斜杠(系统上的每个其他非Unicode应用程序),并正确解释ShiftJIS代码,例如。 Setting it to Dutch gives me an accented I (I forgot which), while another codepage would give a half-filled vertical solid instead on the same character. 把它设置为荷兰语给了我一个重音我(我忘了哪个),而另一个代码页会给出一个半满的垂直实体,而不是同一个字符。

Not Unicode. 不是Unicode。 Unicode would let me do all three at the same time. Unicode会让我同时做这三个。

The console uses a TextWriter with an encoding created from the codepage. 控制台使用带有从代码页创建的编码的TextWriter。 That means that the characters written are encoded into bytes using the specific Encoding object for the codepage. 这意味着使用代码页的特定编码对象将写入的字符编码为字节。

the console doesn't support Unicode. 控制台不支持Unicode。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM