Hi I was trying to output unicode string to a console with iostreams and failed.
I found this: Using unicode font in c++ console app and this snippet work
The wcout must have the locale set differently to the CRT. Here's how it can be fixed:
int _tmain(int argc, _TCHAR* argv[])
{
char* locale = setlocale(LC_ALL, "English"); // Get the CRT's current locale.
std::locale lollocale(locale);
setlocale(LC_ALL, locale); // Restore the CRT.
std::wcout.imbue(lollocale); // Now set the std::wcout to have the locale that we got from the CRT.
std::wcout << L"¡Hola!";
std::cin.get();
return 0;
}
I just tested it, and it displays the string here absolutely fine.