Writing a small dialog on terminal, and it supposed to take unicode input.
When input, the first time looks okay, but if you delete the character using backspace, you cannot fully delete them.
reproduce:
- create a py file
test.py
- write single line in this file
input()
, and save - run the file using
python test.py
- input any japanese or chinese sentences, e.g.
这是一个测试
- then try use backspace to delete, it only can only delete to half of the sentence.
(py ver 3.8)
it seems the delete in the terminal only delete one ascii size, where each wide char takes two.
but in python console it does not have this problem.
any idea?
====
updates:
a screen record: https://drive.google.com/file/d/1_jXSF9FxJt4U9_4O-faMyoWPp9mQPdrH/view?usp=sharing
found same problem on Mac+Bash, Mac+Zsh, Ubuntu+Bash, Ubuntu+Konsole
Windows Dos works ok.