I'm trying to print the Chinese character 中
using the types wchar_t
, char16_t
and char32_t
, without success (live example)
#include <iostream>
int main()
{
char x[] = "中"; // Chinese character with unicode point U+4E2D
char y[] = u8"中";
wchar_t z = L'中';
char16_t b = u'\u4e2d';
char32_t a = U'\U00004e2d';
std::cout << x << '\n'; // Ok
std::cout << y << '\n'; // Ok
std::wcout << z << '\n'; // ??
std::cout << a << '\n'; // prints the decimal number (20013) corresponding to the unicode point U+4E2D
std::cout << b << '\n'; // " " "
}
std::string
on non-Windows andwstring
on Windows, but meh). – Blidastd::string
. But try something like making an existing string like "Fußball" uppercase and you will know what I mean. – Blidastd::wcout << z << '\n';
work in my snippet? – Accoutre