Python, Unicode, and the Windows console

前端 未结 13 2143
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-21 04:38

When I try to print a Unicode string in a Windows console, I get a UnicodeEncodeError: \'charmap\' codec can\'t encode character .... error. I assume this is b

相关标签:
13条回答
  • 2020-11-21 05:24

    Despite the other plausible-sounding answers that suggest changing the code page to 65001, that does not work. (Also, changing the default encoding using sys.setdefaultencoding is not a good idea.)

    See this question for details and code that does work.

    0 讨论(0)
提交回复
热议问题