I tried setlocale, wchar, usual char... how to define:
char c = '☻'
cout << c << endl;
to print onto console anething (this is relevant to VS2012 and http://ideone.com/LJtDUz)
I tried setlocale, wchar, usual char... how to define:
char c = '☻'
cout << c << endl;
to print onto console anething (this is relevant to VS2012 and http://ideone.com/LJtDUz)
The problem is that windows by default does not handle Unicode characters and the windows console is not able to display them.
A solution I found at This CPP Thread is as follows:
#include <fcntl.h>
#include <io.h>
#include <iostream>
int
main(int argc, char* argv[])
{
wchar_t* c = L"☻"; /* needed because the project is using 'Unicode Character Set' */
_setmode(_fileno(stdout), _O_WTEXT); /* set stdout to UTF16 */
std::wcout << c << std::endl; /* use a wide cout call to output characters */
getchar();
return 0;
}
When you try and use the ☻
symbol directly in your code, windows will tell you that i needs to convert your files to Unicode
, make sure to accept that and use Unicode Character Set
as your projects character set type.