当前位置: 动力学知识库 > 问答 > 编程问答 >

encoding - How can I display special symbols like flowers symboles on CMD with C#?

问题描述:

According to name of topic I tried to display some special symbols on CMD with C#,but when I use for example \u273F to display a flower,the result is only ? characters!!!

I changed the cmd font to lucida console and I used these line but none of them was helpful.

Console.OutputEncoding = Encoding.UTF8;

Console.OutputEncoding = System.Text.UTF8Encoding.UTF8;

What can I do else? I searched a lot on the net,but I didn't take any way to solve my issue!!!

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace UniCodes

{

class Program

{

static void Main(string[] args)

{

Console.OutputEncoding = System.Text.UTF8Encoding.UTF8;

Console.WriteLine("This is a list of unicodes of some characters"+

"\n"+ @"\u0000"+" \t"+"\u0000"+

"\n"+ @"\u0001"+" \t"+"\u0001"+

"\n"+ @"\u0002"+" \t"+"\u0002"+

"\n"+ @"\u0003"+" \t"+"\u0003"+

"\n"+ @"\u0004"+" \t"+"\u0004"+

"\n"+ @"\u0005"+" \t"+"\u0005"+

"\n"+ @"\u0006"+" \t"+"\u0006"+

"\n"+ @"\u0007"+" \t"+"\u0007"+

"\n"+ @"\u0008"+" \t"+"\u0008"+

"\n"+ @"\u0009"+" \t"+"\u0009"+

"\n"+ @"\u0010"+" \t"+"\u0010"+

"\n"+ @"\u0020"+" \t"+"\u0020"+

"\n"+ @"\u0030"+" \t"+"\u0030"+

"\n"+ @"\u0040"+" \t"+"\u0040"+

"\n"+ @"\u0050"+" \t"+"\u0050"+

"\n"+ @"\u0060"+" \t"+"\u0060"+

"\n"+ @"\u0070"+" \t"+"\u0070"+

"\n"+ @"\U0080"+" \t"+"\u0080"+

"\n"+ @"\u0090"+" \t"+"\u0090"+

"\n"+ @"\u0011"+" \t"+"\u0011"+

"\n"+ @"\u0012"+" \t"+"\u0012"+

"\n"+ @"\u0013"+" \t"+"\u0013"+

"\n"+ @"\u0014"+" \t"+"\u0014"+

"\n"+ @"\u0015"+" \t"+"\u0015"+

"\n"+ @"\u0016"+" \t"+"\u0016"+

"\n"+ @"\u0017"+" \t"+"\u0017"+

"\n"+ @"\u0018"+" \t"+"\u0018"+

"\n"+ @"\u0019"+" \t"+"\u0019"+

"\n"+ @"\u0021"+" \t"+"\u0021"+

"\n"+ @"\u0022"+" \t"+"\u0022"+

"\n"+ @"\u0023"+" \t"+"\u0023"+

"\n"+ @"\u0024"+" \t"+"\u0024"+

"\n"+ @"\u0025"+" \t"+"\u0025"+

"\n"+ @"\u0026"+" \t"+"\u0026"+

"\n"+ @"\u0027"+" \t"+"\u0027"+

"\n"+ @"\u0028"+" \t"+"\u0028"+

"\n"+ @"\u0029"+" \t"+"\u0029"+

"\n"+ @"\u0031"+" \t"+"\u0031"+

"\n"+ @"\u0032"+" \t"+"\u0032"+

"\n"+ @"\u0033"+" \t"+"\u0033"+

"\n"+ @"\u0034"+" \t"+"\u0034"+

"\n"+ @"\u0035"+" \t"+"\u0035"+

"\n"+ @"\u0036"+" \t"+"\u0036"+

"\n"+ @"\u0037"+" \t"+"\u0037"+

"\n"+ @"\u0038"+" \t"+"\u0038"+

"\n"+ @"\u0039"+" \t"+"\u0039"+

"\n"+ @"\u0041"+" \t"+"\u0041"+

"\n"+ @"\u0042"+" \t"+"\u0042"+

"\n"+ @"\u0043"+" \t"+"\u0043"+

"\n"+ @"\u0044"+" \t"+"\u0044"+

"\n"+ @"\u0045"+" \t"+"\u0045"+

"\n"+ @"\u0046"+" \t"+"\u0046"+

"\n"+ @"\u0047"+" \t"+"\u0047"+

"\n"+ @"\u0048"+" \t"+"\u0048"+

"\n"+ @"\u0049"+" \t"+"\u0049"+

"\n"+ @"\u0051"+" \t"+"\u0051"+

"\n"+ @"\u0052"+" \t"+"\u0052"+

"\n"+ @"\u0053"+" \t"+"\u0053"+

"\n"+ @"\u0054"+" \t"+"\u0054"+

"\n"+ @"\u0055"+" \t"+"\u0055"+

"\n"+ @"\u0056"+" \t"+"\u0056"+

"\n"+ @"\u0057"+" \t"+"\u0057"+

"\n"+ @"\u0058"+" \t"+"\u0058"+

"\n"+ @"\u0059"+" \t"+"\u0059"+

"\n"+ @"\u0061"+" \t"+"\u0061"+

"\n"+ @"\u0062"+" \t"+"\u0062"+

"\n"+ @"\u0063"+" \t"+"\u0063"+

"\n"+ @"\u0064"+" \t"+"\u0064"+

"\n"+ @"\u0065"+" \t"+"\u0065"+

"\n"+ @"\u0066"+" \t"+"\u0066"+

"\n"+ @"\u0067"+" \t"+"\u0067"+

"\n"+ @"\u0068"+" \t"+"\u0068"+

"\n"+ @"\u0069"+" \t"+"\u0069"+

"\n"+ @"\u0071"+" \t"+"\u0071"+

"\n"+ @"\u0072"+" \t"+"\u0072"+

"\n"+ @"\u0073"+" \t"+"\u0073"+

"\n"+ @"\u0074"+" \t"+"\u0074"+

"\n"+ @"\u0075"+" \t"+"\u0075"+

"\n"+ @"\u0076"+" \t"+"\u0076"+

"\n"+ @"\u0077"+" \t"+"\u0077"+

"\n"+ @"\u0078"+" \t"+"\u0078"+

"\n"+ @"\u0079"+" \t"+"\u0079"+

"\n"+ @"\u000A"+" \t"+"\u000A"+

"\n"+ @"\u000B"+" \t"+"\u000B"+

"\n"+ @"\u000C"+" \t"+"\u000C"+

"\n"+ @"\u000D"+" \t"+"\u000D"+

"\n"+ @"\u000E"+" \t"+"\u000E"+

"\n"+ @"\u000F"+" \t"+"\u000F"+

"\n"+ @"\u000a"+" \t"+"\u000a"+

"\n"+ @"\u00A0"+" \t"+"\u00A0"+

"\n"+ @"\u00A1"+" \t"+"\u00A1"+

"\n"+ @"\u00A2"+" \t"+"\u00A2"+

"\n"+ @"\u00A3"+" \t"+"\u00A3"+

"\n"+ @"\u00A4"+" \t"+"\u00A4"+

"\n"+ @"\u00A5"+" \t"+"\u00A5"+

"\n"+ @"\u00A6"+" \t"+"\u00A6"+

"\n"+ @"\u00A7"+" \t"+"\u00A7"+

"\n"+ @"\u00A8"+" \t"+"\u00A8"+

"\n"+ @"\u00A9"+" \t"+"\u00A9"+

"\n"+ @"\u00B1"+" \t"+"\u00B1"+

"\n"+ @"\u00B2"+" \t"+"\u00B2"+

"\n"+ @"\u00B3"+" \t"+"\u00B3"+

"\n"+ @"\u00B4"+" \t"+"\u00B4"+

"\n"+ @"\u00B5"+" \t"+"\u00B5"+

"\n"+ @"\u00B6"+" \t"+"\u00B6"+

"\n"+ @"\u00B7"+" \t"+"\u00B7"+

"\n"+ @"\u00B8"+" \t"+"\u00B8"+

"\n"+ @"\u00B9"+" \t"+"\u00B9"+

"\n"+ @"\u00C0"+" \t"+"\u00C0"+

"\n"+ @"\u00C1"+" \t"+"\u00C1"+

"\n"+ @"\u00E2"+" \t"+"\u00E2"+

"\n"+ @"\u00E3"+" \t"+"\u00E3"+

"\n"+ @"\u00E4"+" \t"+"\u00E4"+

"\n"+ @"\u00E5"+" \t"+"\u00E5"+

"\n"+ @"\u00D1"+" \t"+"\u00D1"+

"\n"+ @"\u00F2"+" \t"+"\u00F2"+

"\n"+ @"\u00F5"+" \t"+"\u00F5"+

"\n"+ @"\u00F4"+" \t"+"\u00F4"+

"\n"+ @"\u00F3"+" \t"+"\u00F3"+

"\n"+ @"\u001a"+" \t"+"\u001a"+

"\n"+ @"\u001B"+" \t"+"\u001B"+

"\n"+ @"\u001C"+" \t"+"\u001C"+

"\n"+ @"\u001D"+" \t"+"\u001D"+

"\n"+ @"\u001E"+" \t"+"\u001E"+

"\n"+ @"\u002a"+" \t"+"\u002a"+

"\n"+ @"\u003a"+" \t"+"\u003a"+

"\n"+ @"\u004a"+" \t"+"\u004a"+

"\n"+ @"\u005a"+" \t"+"\u005a"+

"\n"+ @"\u006a"+" \t"+"\u006a"+

"\n"+ @"\u007a"+" \t"+"\u007a"+

"\n"+ @"\u2070"+" \t"+"\u2070"+

"\n"+ @"\u221A"+" \t"+"\u221A"+

"\n"+ @"\u2211"+" \t"+"\u2211"+

"\n"+ @"\u2229"+" \t"+"\u2229"+

"\n"+ @"\u221E"+" \t"+"\u221E"+

"\n"+ @"\u263c"+" \t"+"\u263c"+

"\n"+ @"\u2261"+" \t"+"\u2261"+

"\n"+ @"\u2248"+" \t"+"\u2248"+

"\n"+ @"\u2320"+" \t"+"\u2320"+

"\n" + @"\u273F" + " \t" + "\u273F"

);

Console.ReadLine();

}

}

}

网友答案:

You need to configure it to use Unicode character set. Also, as Eugene says, here's a more explained answer:

How to write unicode chars to console?

网友答案:

I installed some monospaced-fonts with special characters, but none of them were suitable to introduce to CMD.

AND I understood that my asked(set a font like Wingdings font to CMD for have some lovely character on CMD) is an impossible action. however I'm glad to take this experience .

Thanks every one...

分享给朋友:
您可能感兴趣的文章:
随机阅读: