通过不同的输出编码输出 Unicode 值 C#
我正在尝试控制台输出选项并注意到这一点:
Console.OutputEncoding = System.Text.Encoding.Unicode;
Console.WriteLine("\u266F");
Console.WriteLine("\u6F26");
所以我将编码设置为 Unicode(UTF-16LE) 并且我尝试输出尖锐字符 "\u266F" 这是 UTF-8 中的升号 "\u6F26" 这是 UTF-16LE 中的锐号
所以我有 2 个问题
为什么这个“\u266F”输出锐利时它是 UTF-8 格式,我已将编码器设置为 Unicode
如果它在 UTF-16LE 格式且编码器为 UTF- 格式,为什么不输出锐号? 16LE也是。
I am experimenting with the Console Output Options and have noticed this:
Console.OutputEncoding = System.Text.Encoding.Unicode;
Console.WriteLine("\u266F");
Console.WriteLine("\u6F26");
So I set the Encoding to Unicode(UTF-16LE) and I am trying to output the sharp character
"\u266F" This is the sharp in UTF-8
"\u6F26" This is the sharp in UTF-16LE
You can see the output in the screenshot
So I have 2 questions
Why does this "\u266F" output a sharp when It is in UTF-8 and I have set the Encoder to Unicode
Why doesn't this output a sharp if it is in UTF-16LE and the Encoder is in UTF-16LE too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论