Printing Unicode Characters on Windows

So I found this function
1
2
_setmode(_fileno(stdout), _O_U16TEXT);
wcout << L" ≡ works, but   ≣ or \u2263 doesn't";


which needs
1
2
#include <fcntl.h>
#include <io.h> 


To sort of allow me to print some unicode characters on Windows. I thought I would be able to print all UTF-16 characters but apparently not. In fact even setting to UTF-16 only allows me to use very few foreign characters. Seems the console just can't print them?


So I was wondering whether at all it is possible to print all UTF-16 characters whether be it modifying some stuff or having to include something. It must be console related.

Using Visual Studios C++ 2017.
Last edited on
You need to set the console font to a font that supports the characters that you are trying to print.
How do I do that?

Wait I don't get what you mean by change font.. Like change font font? Then are you saying I can't have all UTF characters at once? How do I change font and to what do I change it to? If I want the 'strictly equal to symbol' ( ≣ ) then how do I know which font would have it?
Last edited on
On the System menu on the top left of the console window.
Click on it and under Properties->Font you can change it. Since there are only 2 options(Win 7) just try.
Another option is to use SetConsoleFont from the Windows APi
That just changes how the text looks..? *scratches head* Do they have different characters?
I don't think either of them will have symbols for chess pieces or the symbol for 'strictly equal to' (which I need to signify quadruple bond for representing chemical compound structures).

By the way 7 fonts on Win 10
You may need to install additional fonts and enable them for the Windows console.
See: https://www.howtogeek.com/howto/windows-vista/stupid-geek-tricks-enable-more-fonts-for-the-windows-command-prompt/
Be careful while editing the registry (good idea to take a backup first).

List of some fonts: http://www.alanwood.net/unicode/fonts.html
Thanks JLBorges I'll have a look at it later when I can. By the way I was wondering if there is a something I can use to have a portable way to print foreign characters on something like a console, or at least something that is relatively easy to use if it isn't console related.

Or something I can use to easily build short GUI windows. A helper application, basically. Any other console manipulating library would be helpful too unless it gets too complicated.
Topic archived. No new replies allowed.