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
  • 505,946
  • 29
  • 409
  • 696
czerny
  • 13,045
  • 13
  • 64
  • 86
  • 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
  • 134,614
  • 21
  • 188
  • 335