This question already has an answer here:
Python 2.7 : LookupError: unknown encoding: cp65001
but my case is slightly different. I'm using msys (mingw64) terminal to build a project; I have two versions of python 3.8 and 2.7. After setting:
set PYTHONIOENCODING=UTF-8
as suggested in the accepted answer, only python3 sees the variable:
MINGW64 /c/Disk_D_Backup/Projects/zyn-fusion-build
$ set PYTHONIOENCODING=utf-8
MINGW64 /c/Disk_D_Backup/Projects/zyn-fusion-build
$ python3 -c "import sys; print('Encoding='+sys.stdin.encoding)"
Encoding=utf-8
MINGW64 /c/Disk_D_Backup/Projects/zyn-fusion-build
$ python2 -c "import sys; print('Encoding='+sys.stdin.encoding)"
Encoding=cp65001
Python2 doesn't. Why?