Unicode on Windows

Using Python to generate Unicode output on Windows produces errors such as

UnicodeEncodeError: ‘charmap’ codec can’t encode character ‘\u03b2’ in position 1532: character maps to

Is there a way to configure Windows to avoid this?

This is not a question about how to change the code to avoid the error, but how to configure Windows so that code that works on all other platforms works there.

How and if it’s even possible without modifying your program depends on what code that error happens in. For Python 2, it’s a known problem that you can’t output Unicode reliably.

E.g. if the error you are referencing happens on output to stdout, you can use PYTHONIOENCODING=utf8.

1 Like

Thanks! PYTHONIOENCODING=utf8 seems to have done the trick.