The library readlinethat Python uses to read interactive input does not accept non-ASCII characters sent by the terminal. This means that either your terminal emulator does not provide UTF-8 encoded characters, or readline is not configured to accept UTF-8 input.
Fortunately, readline is used by many popular programs, including the shell bash, so there is a lot of information on how to make it work. For example, from this article :
How can I enter the input of UTF-8 correctly?
- In the terminal Inspector:
- In the "Emulation" section, disable the "Escape non-ASCII" characters.
- Under Screen, select Unicode (UTF-8) as the character set encoding.
Add the following line to .profile:
export LC_CTYPE=en_US.UTF-8
Add the following lines to .inputrc:
set meta-flag on
set input-meta on
set output-meta on
set convert-meta off
, source ~/.profile source
~/.inputrc.