Problem
The problem arises when I want to input Unicode character in the Python interpreter (for simplicity, I have used a-umlaut in the example, but I have first encountered this for Farsi characters). Whenever I use Python with the CHCP 65001
code page and then try to input even one Unicode character, Python exits without any error.
I have spent days trying to solve this problem to no avail. But today, I found a thread on the Python website, another on MySQL and another on Lua-users which issues were raised regarding this sudden exit, although without any solution and some saying that chcp 65001
is inherently broken.
It would be good to know once and for all whether this problem is chcp-design-related or there is a possible workaround.
Reproduce Error
chcp 65001
Python 3.X:
Python shell
print('ä')
result: it just exits the shell
However, this works python.exe -c "print('ä')"
and also this: print('\u00e4')
result: ä
in Luajit2.0.4
print('ä')
Result: it just exits the shell
However this works: print('\xc3\xa4')
I have come up with this observation so far:
- direct output with the command prompt works.
- Unicode-based, hex-based equivalent of the character works.
So
This is not a Python bug and that we can't use a Unicode character directly in CLI programs in Windows command prompt or any of its wrappers like ConEmu, Cmder (I am using Cmder to be able to see and use Unicode character in Windows shell and I have done so without any problem). Is this correct?