0

I've got a character for a blackjack game but python can't encode it. I've looked up a few things but have not found a good solution and need help.
The error:UnicodeEncodeError: 'charmap' codec can't encode character '\u2666' in position 5: character maps to undefined
Here's my code:

SUITES = ["♥", "♠", "♣", "♦"]
RANKS = ['A','2','3','4','5','6','7','8','9','X','J','Q','K']
VALUES = [11,2,3,4,5,6,7,8,9,10,10,10,10]
class Card:
    def __init__(self, suit, rank):
        self.suit = suit
        self.rank = rank
        self.value = VALUES[RANKS.index(rank)]

    def get_str(self):
        print("{} of {}".format(self.rank, self.suit))
Wyrden
  • 45
  • 6
  • This is an issue with how your console is configured, rather than the Python code itself. " I've looked up a few things but have not found a good solution and need help." It's not helpful to tell us this, and it is also [not a question](https://meta.stackoverflow.com/questions/284236). You should instead *show* the things you looked up; show what things you tried and how you tried them; *explain why* they are "not a good solution" (Did they not solve the problem? Something else?) and *ask a specific question* per [ask]. – Karl Knechtel May 09 '22 at 17:18
  • I can't reproduce your problem in IDLE or when running the code from the Windows console. If I do `c = Card(SUITES[0],RANKS[0])` then `c.get_str()` results in `A of ♥` which I think is correct. – BoarGules May 09 '22 at 17:18

0 Answers0