Unicode特殊字符未显示在标签中 [英] Unicode special character not displaying in label

查看:68
本文介绍了Unicode特殊字符未显示在标签中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打印那种字符,但是我不明白,我以为C#支持Unicode.

I would like to print that kind of character, but I dont get it, I thought c# supports unicode.

我解决的方式:

label3.Text = "\u1F6B5";

这不是唯一的符号,它不起作用.

This is not the only symbol ,which does not work.

谢谢.

推荐答案

  label3.Text = "\u1F6B5";

\ u 转义仅使用4个十六进制数字,因此您尝试使用5.因此,最后得到一个包含两个字符的字符串,即'\ u1F6B'和'5'.看起来像Ὣ5",不是您想要的.

The \u escape takes only 4 hex digits, you are trying to use 5. So you end up with a string that contains two characters, '\u1F6B' and '5'. Looks like "Ὣ5", not what you want.

使用来自高位平面的代码点(代码> = 0x10000)需要大写字母U才能正确地编码为字符串文字.修复:

Using codepoints from the upper bit planes (codes >= 0x10000) require a capital U to get properly encoded into a string literal. Fix:

  label3.Text = "\U0001F6B5";

机器还需要一种包含该字形的字体.当您看到矩形时,您会知道它不见了.

The machine also needs a font that contains the glyph. You'll know it is missing when you see a rectangle instead.

这篇关于Unicode特殊字符未显示在标签中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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