This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: input() should respect sys.stdin.encoding when in interactive mode
Type: behavior Stage:
Components: Unicode Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: loewis, philyoon
Priority: normal Keywords:

Created on 2007-09-04 02:21 by philyoon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg55627 - (view) Author: Sangpil Yoon (philyoon) Date: 2007-09-04 02:21
Currently in interactive mode, when you try to input non-ascii
characters using input() builtin function, you get UnicodeDecodeError.

>>> print(input())
윤상필
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 0-1:
illegal encoding

The error says that input() function is trying to decode the byte string
using the utf8 codec, when sys.stdin.encoding is not 'utf8'.

>>> import sys; print(sys.stdin.encoding)
cp949

In non-interactive mode, input() works just fine.
msg55629 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-09-04 05:25
Thanks for the report. This is now fixed in r57947
History
Date User Action Args
2022-04-11 14:56:26adminsetgithub: 45438
2007-09-04 05:25:44loewissetstatus: open -> closed
resolution: fixed
messages: + msg55629
nosy: + loewis
2007-09-04 02:21:41philyooncreate