wcout.imbue(std::locale("chs"));
wchar_t *a = L"☻";
wcout << *a;
It's not work, why? What should I do?
wcout.imbue(std::locale("chs"));
wchar_t *a = L"☻";
wcout << *a;
It's not work, why? What should I do?
Possible errors:
L"☻"
as a unicode string in the source file.You could use the unicode character code for it instead ("\u263B"
). Make sure the console supports unicode and that the font has a corresponding character for it.
It may also be easier (depending on the compiler support) to use the unicode character literals for C++ 11;
char a[] = u8"My \u263B character";
cout << a;
This should work (u8
since c++11
):
char smiley[] { u8"\u263b" };
cout << smiley << '\n';
Or you could also just do:
char smiley[] { "\u263b" };
cout << smiley << '\n';