在C#中输出Unicode字符 [英] Outputting a Unicode character in C#

查看:257
本文介绍了在C#中输出Unicode字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编程和自学的新手。我正在尝试输出金牛座的占星符号,它应该是Unicode的U + 2649。这是我正在使用的代码...

I'm new to programming and self taught. I'm trying to output the astrological symbol for Taurus, which is supposed to be U+2649 in Unicode. Here is the code I'm using...

string myString = "\u2649";
byte[] unicode = System.Text.Encoding.Unicode.GetBytes(myString);
Console.WriteLine(unicode.Length);

我得到的结果是数字2,而不是符号或字体。我确定我做错了。

The result I'm getting is the number 2 instead of the symbol or font. I'm sure I'm doing something wrong.

推荐答案

您需要使用一种字体来显示该字形。如果这样做,则:

You need to have a font which displays that glyph. If you do, then:

Console.WriteLine(myString); 

是您所需要的。

编辑:请注意,我唯一能找到的带有该标志符号的字体是 MS Reference Sans Serif。​​

Note, the only font I could find which has this glyph is "MS Reference Sans Serif".

这篇关于在C#中输出Unicode字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆