在控制台中显示UTF-8字符 [英] Show UTF-8 characters in console

查看:61
本文介绍了在控制台中显示UTF-8字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在控制台中打印UTF8字符?

How can I print UTF8 characters in the console?

使用 Console.Writeline(îăşâţ"),我在控制台中看到îas>.

With Console.Writeline("îăşâţ") I see îasât in console.

推荐答案

您可以找到一些技巧,这些技巧演示了如何将多字节字符集写入控制台,但是这些技巧是不可靠的.它们要求您的控制台字体是支持它的字体,通常,我会避免这种情况.(如果您的用户不做额外的工作,那么所有这些技术都将失效.因此,它们是不可靠的.)

There are some hacks you can find that demonstrate how to write multibyte character sets to the Console, but they are unreliable. They require your console font to be one that supports it, and in general, are something I would avoid. (All of these techniques break if your user doesn't do extra work on their part... so they are not reliable.)

如果您需要编写Unicode输出,我强烈建议您制作一个GUI应用程序来处理此问题,而不要使用控制台.制作一个简单的GUI只是将您的输出写入支持Unicode的控件是相当容易的.

If you need to write Unicode output, I highly recommend making a GUI application to handle this, instead of using the Console. It's fairly easy to make a simple GUI to just write your output to a control which supports Unicode.

这篇关于在控制台中显示UTF-8字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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