如何在Windows上从c ++控制台应用程序打印UTF-8 [英] How do I print UTF-8 from c++ console application on Windows

查看:418
本文介绍了如何在Windows上从c ++控制台应用程序打印UTF-8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于在英语版Windows(XP,Vista或7)上使用Visual Studio 2008编译的C ++控制台应用程序。是否可以打印到控制台,并使用cout或wcout正确显示UTF-8编码日语?

解决方案

Windows控制台默认使用 OEM代码页显示输出。



要将代码页更改为Unicode,请在控制台中输入 chcp 65001 ,或尝试更改代码使用 SetConsoleOutputCP 以编程方式页面。 p>

请注意,您可能需要将控制台的字体更改为在unicode范围内具有字形的字体。


For a C++ console application compiled with Visual Studio 2008 on English Windows (XP,Vista or 7). Is it possible to print out to the console and correctly display UTF-8 encoded Japanese using cout or wcout?

解决方案

The Windows console uses the OEM code page by default to display output.

To change the code page to Unicode enter chcp 65001 in the console, or try to change the code page programmatically with SetConsoleOutputCP.

Note that you probably have to change the font of the console to one that has glyphs in the unicode range.

这篇关于如何在Windows上从c ++控制台应用程序打印UTF-8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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