There are no standard output streams for unicode char types. Standard output streams exist only for narrow native character type char
and the wide native character type wchar_t
. You will have to convert the char16_t
and char32_t
(and char8_t
) strings to one of those types in order to meaningfully write to the standard output stream.
Due to lack of standard output stream support, char16_t
and char32_t
(and char8_t
) are only really useful for writing into files.
Both narrow and wide output native character encoding - which are used by the standard streams - may be but aren't necessarily unicode. That depends on the system configuration. In case the native encoding isn't unicode, that encoding won't necessarily be able to represent the unicode string that you wish to display.
Here is a way to display 猫 without using char16_t
nor char32_t
with the precondition that the compiler and the system support unicode as the narrow native encoding:
std::cout << "猫";
See it here.