I've spent the last three days searching about printing accented, box drawing, or whatever character on the console but I came up with only one solution so far, in which I'm quite skeptical. Basically I call the function setlocale(LC_ALL, "") and imagine you have to read or write from a screen buffer, would the operation complete correctly or will it encounter some problems? Also I've tried to change the code page trough the SetConsoleCP() function, but nothing happened. Other suggestions say I could use wchar_t, wstring and wcout but I read some articles which told me to avoid their usage or at least discourage it. Probably I'm a little lost and I'm messing up something, I don't know.
Other suggestions say I could use wchar_t, wstring and wcout but I read some articles which told me to avoid their usage or at least discourage it.
This may be your problem, you can't print unicode with std::cout and char.
Also you can't mix cout with wcout because stream will be set to one you use first! ,choose either wide or ascii mode and stick to it in your entry program including stream output (cout/wcout)
Those who say to avoid wcout don't know what they are talking about, that's just my opinion ofc.
whether you can print unicode to console or not depends. There is some command you can issue to the consoles to enable it, I believe, but I always forget it because english.
Here is sample to to write both to console and to file with unicode strings,
This is of course a windows solution, but should be easy to extend for other systems.
I kept searching and finally I found a solution along the lines of your (malibor) one. Which set the console output to CP_UTF8 etc. but it turned out it wasn't right, I still can't display accented character or whatever and instead I have blank spaces, thus I decided to stick around with the setlocale option. Anyway thank you for your answer I appreciated it