Properly print utf8 characters in windows console
问题 This is the way I try to do it: #include <stdio.h> #include <windows.h> using namespace std; int main() { SetConsoleOutputCP(CP_UTF8); //german chars won't appear char const* text = "aäbcdefghijklmnoöpqrsßtuüvwxyz"; int len = MultiByteToWideChar(CP_UTF8, 0, text, -1, 0, 0); wchar_t *unicode_text = new wchar_t[len]; MultiByteToWideChar(CP_UTF8, 0, text, -1, unicode_text, len); wprintf(L"%s", unicode_text); } And the effect is that only us ascii chars are displayed. No errors are shown. The