I am working on a blackjack game where I want to show the cards like this: A♣ for the ace of spades. Ive tryed copy/paste and "/U2660". neither worked. How can I do this?
I'll assume you're using cmd.exe as terminal.
cmd.exe sucks at Unicode. If they were going to write a console emulator, I don't know why Microsoft didn't pimped it up a bit. I mean, just look at Konsole, for example.
Anyway, you could one of the sub U+0020 characters for this:
Spade: (char)6
Club: (char)5
Heart: (char)3
Diamond: (char)4
I don't like this approach very much, though.
And now, I'm so dissatisfied I'm going to go look for a console emulator with better Unicode support.
Helios Thank you for your reply. I just figured out what I had wrong. I was using the upper case 'U' and not a lower case 'u'. Now that I have that fixed I see what you mean by "cmd.exe sucks at Unicode". Instead of the pretty spade (haha I showed a club not a spade. oops) , I get 3 odd looking characters.
What is a sub U+0020 character?
Here is the code I am using to test my unicode output.
Interesting...
'\u####' generates a UTF-8 string. I didn't know that.
You see? That's exactly what I mean. If cmd.exe was a decent terminal emulator, you'd had seen the expected result. A club suit symbol.
By "sub U+0020", I mean all ASCII characters in code points lower than space (' ', U+0020).
Try printing those values I posted earlier. std::cout <<(char)6<<std::endl;
I could, but I won't.
Using special characters to display the arbitrary images that were assigned to them is a bad idea, and I don't want you to get used to them.
Why is it a bad idea? From what Ive learned here, I can see there may be issues with consoles not supporting a code. Are there other reason why I should not use special characters in my all text programs?
Helios, I dont quite understand your answer. You seem to know your stuff, so I will keep your advice in mind. Until I learn how and when special characters should be used Ill limit my use of them.
I wasnt able to find a list online but I was able to edit your code to make a list of 256 characters. This is for anyone else that might be curious
Yeah, the first 16 or so are special characters, they do beeps, newlines, tabs, etc...and the other special characters could theoretically get something assigned to them and screw up your program.