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

python input() with wide characters (jp or cn) is not working properly on Mac terminal

$
0
0

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:

  1. create a py file test.py
  2. write single line in this file input(), and save
  3. run the file using python test.py
  4. input any japanese or chinese sentences, e.g. 这是一个测试
  5. 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.


Viewing all articles
Browse latest Browse all 13951

Trending Articles



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