Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14011

Error occurs when trying to redirect Python UTF-8 stdout to a file on Windows

$
0
0

When I try to redirect a UTF-8 stdout in Powershell by running python3 .\test.py > test.txt, error occurs :

UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: character maps to <undefined>

The code in test.py are as following and that is encoded by UTF-8.

print("\u2714")

The code is uploaded here.https://github.com/lingsongfeng/pytest


Viewing all articles
Browse latest Browse all 14011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>