When I try to printprint a Unicode string in a Windows console, sometimes I get an error that says .
UnicodeEncodeError: 'charmap' codec can't encode character ....
. I assume this is because the Windows console does not acceptcannot handle all Unicode-only characters. What's the best way
How can I work around this? Is there any way I For example, how can I make Python automatically printthe program display a replacement character (such as ?) instead of failing in this situation?
Edit: I'm using Python 2.5.
Note: @LasseV.Karlsen answer with the checkmark is sort of outdated (from 2008). Please use the solutions/answers/suggestions below with care!!
@JFSebastian answer is more relevant as of today (6 Jan 2016).