'Why is the emoji displays incorrectly in Windows Terminal?

I try to use C++ to output a emoji and below is the code. I wrote this in VS Code.

#include <iostream>

int main() {
    std::cout << "😊";
    return 0;
}

Then I try to compile this code with Clang++ and get a .exe file. But when I run the .exe file in Windows Terminal it doesn't display correctly.

Below is what I get when I run the file.

PS C:\Users\26354> D:\Code_exercise\Assignment\Class\Bin\Temp.exe
馃槉

PS:

Clang version 13.0.1

Target: x86_64-pc-windows-msvc

Windows Terminal Version: 1.12.10393.0

VS Code Version: 1.64.2

Windows Version: Windows 10 Pro 21H2



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source