I'm trying to output unicode symbols from Python 3. The program is a simple one-liner where I'm printing non-ascii literals:
print("íó")
The program is encoded in utf-8.
I'm running this program on two different Windows machines (Windows 7, Windows 10); on each machine I'm running this from both cmd and MinGW.
That works on Windows 10 (both cmd and MinGW).
On Windows 7 the output is decayed to ascii if run from cmd, and Python throws an exception if being run from MinGW:
Traceback (most recent call last): File "test.py", line 4, in print("\xed\xf3") File "C:\Program Files (x86)\Python36-32\lib\encodings\cp1251.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: character maps to
What could be the problem? What should be the difference in the machines (the Python and MinGW versions are very close)? What is the difference of Python run from cmd and MinGW that cause the exception?
Machines configurations:
- Windows 7; Python 3.6.0; MinGW 2.8.3
- Windows 10; Python 3.6.5; MinGW 2.8.5