I am trying to insert a unicode value, in this case, \ u250F or ┏, to the console output. I searched around and people recommend different things. Before discussing what I tried, I use Windows and Visual Studio 2013.
Main mistake
When I try to make several “fixes,” if not specified, I always get the same error:
Debug Assertion Failed!
Program: ...nts\visual studio 2013\Projects\roguelike\Debug\roguelike.exe
File: f:\dd\vctools\crt\crtw32\stdio\fputc.c
Line: 48
Expression: ((_Stream->_flag & _IOSTRG) || ( fn = _fileno(_Stream),
((_textmode_safe(fn) == _IOINFO_TM_ANSI && !_tm_unicode_safe(fn))))
For more information on how your program can cause an assertion failure,
see the Visual C++ documentation on asserts
(Press Retry to debug the application)
What i tried
I tried to do all of the following to output it:
std::cout << "\u250F";
std::wcout << "\u250F";
std::cout << L"\u250F";
std::wcout << L"\u250F";
std::cout << "┏";
std::wcout << "┏";
std::cout << L"┏";
std::wcout << L"┏";
How I tried to tell the console how to output unicode
_setmode(_fileno(stdout), _O_U16TEXT);
It seems to be a problem, really.
system("chcp 65001");
Not a mistake, but does nothing
std::locale::global(std::locale("en_US.utf8"));
This causes an error when the parameters are "illegal"
source
share