0

How to print "" emoji (Unicode code 1F469) in Windows console app using C++?

In example below I followed 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;
}

However it only prints two questionmarks:

console screenshot - two questionmarks.

"Command Prompt" (cmd.exe) app can't render this char so I'm using Windows Terminal that can render it:

rendered face emoji in Windows Terminal

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
czerny
  • 15,090
  • 14
  • 68
  • 96
  • There are couple of downvotes, could you please share what you find wrong with this question and recommendation how to approve it? – czerny Apr 02 '20 at 08:45

1 Answers1

1

The Windows Console cannot display characters outside of Plane 0. The Windows Terminal was designed to improve on the limitations of the Windows Console.

Further reading: How to use unicode characters in Windows command line?

M.M
  • 138,810
  • 21
  • 208
  • 365