When you work with Python Logger to STDOUT, sometimes you got error messages as the below:
1 |
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2713' in position 143: ordinal not in range(128) |
The reason is STDOUT does not support UTF-8 encoder.
1 2 3 |
>>> import sys >>> sys.stdout.encoding 'ANSI_X3.4-1968 |
I try to google to solve the issue. And I got the solution. We have to create environment variable PYTHONIOENCODING=utf-8
1 |
export PYTHONIOENCODING=utf-8 |
So It works.
1 2 3 |
>>> import sys >>> sys.stdout.encoding 'utf-8' |