Can't use special characters?
Gldnbr (95)
Feb 3, 2012 at 11:57pm UTC
I want to be able to output special characters to a console in C++.
Some of the special characters include: ★, ∯, ♫, ♕, and so on.
When I output them to the screen, it actually turns out to be a "?".
How can I make it so it actually outputs what I want?
Peter87 (2052)
Feb 4, 2012 at 12:02am UTC
It depends on what encoding is being used. If It's UTF-8 you will need more than one char to represent those chars.
Gldnbr (95)
Feb 4, 2012 at 12:04am UTC
How do I know which encoding I'm using?
hanst99 (2700)
Feb 4, 2012 at 12:11am UTC
If It's UTF-8 you will need more than one char to represent those chars.
Actually, with UTF-8 a char will always be enough. UTF-16 would be problematic though.
As to console output: That has nothing to do with C++, the problem is that the windows console, at least as far as I know, only supports ASCII.
helios (9442)
Feb 4, 2012 at 12:21am UTC
General advice regarding putting Unicode on consoles: don't. If you need Unicode or any other kind of representational cleverness, just use a GUI.
Gldnbr (95)
Feb 4, 2012 at 12:33am UTC
What's the difference between console and GUI?
And what is recommended?
Luc Lieber (732)
Feb 4, 2012 at 12:41am UTC
I would say that in the most broad sense, a console is an example of a GUI, but what's normally referred to as a GUI would be something more like notepad, vim, etc. There's no clear-cut recommendation for using a console versus a GUI, as it is all in relation to your solution. As helios and Duoas stated, if your aim is to display unicode, then a GUI would be the way to go.
Topic archived. No new replies allowed.