Redirect to file fails!See original GitHub issue
from __future__ import unicode_literals import win_unicode_console win_unicode_console.enable() print u"ÄäБб"
Works if it’s called from console, but as far as it’s redirected to a file:
print u"ÄäБб" UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
- Created 8 years ago
- Comments:44 (21 by maintainers)
Top GitHub Comments
When I try
py -3 -c "print('α')" > out.txt, it saves as utf-8 when
PYTHONIOENCODING=utf-8 is set. If you are talking about output to console, then of course it doesn’t work, that’s why
win_unicode_console exists in the first place.