I’ve tripped over this on 2 machines now and end up at the same out of date StackOverflow post, so maybe this will help someone else.
Situation
When you try to print a string with a Unicode character to the console on Windows in Python, you get:
UnicodeEncodeError: 'charmap' codec can't encode characters in position 20-21: character maps to <undefined>
Looking something like this:
Fix
Windows command-line supports unicode now, and Python 3.6+ ties into this support automatically (prior version requires win-unicode-console). You just need a slight bit of magic dust.
Add an environment variable named PYTHONIOENCODING to your environment settings, like so:
And now when you execute, you get console output instead of an error: