【问题标题】:How to print 4 byte Unicode character in Windows C++ console app?如何在 Windows C++ 控制台应用程序中打印 4 字节 Unicode 字符?
【发布时间】:2020-04-02 03:03:20
【问题描述】:

如何使用 C++ 在 Windows 控制台应用程序中打印 "????" emoji(Unicode 代码 1F469)?

在下面的示例中,我关注了Printing UTF-8 Text to the Windows Console

#include <iostream>
#include <io.h>
#include <fcntl.h>

int main()
{
    _setmode(_fileno(stdout), _O_U16TEXT);
    std::wcout << L"face: ????\n";
    return 0;
}

但是它只打印两个问号:

.

“命令提示符”(cmd.exe) 应用程序无法渲染此字符,因此我正在使用可以渲染它的 Windows Terminal

【问题讨论】:

  • 有几个反对意见,您能否分享您对这个问题的看法以及如何批准它的建议?

标签: c++ windows console-application windows-console unicode-string


【解决方案1】:

Windows 控制台无法显示平面 0 之外的字符。Windows 终端旨在改进 Windows 控制台的限制。

延伸阅读:How to use unicode characters in Windows command line?

【讨论】:

    猜你喜欢
    • 2023-01-03
    • 2012-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多