[issue28333] input() with Unicode prompt produces mojibake on Windows

Steve Dower report at bugs.python.org
Fri Oct 7 18:08:01 EDT 2016


Steve Dower added the comment:

This may force issue17620 into 3.6 - we really ought to be getting and using sys.stdin and sys.stderr in PyOS_StdioReadline() rather than going directly to the raw streams.

The problem here is that we're still using fprintf to output the prompt, even though we know (assume) the input is utf-8.

I haven't looked closely at how safely we can use Python objects from this code, except to see that it's not obviously safe, but we should really figure out how to deal in Python str rather than C char* for the default readline implementation (and then only fall back on the GNU protocol when someone asks for it).

The faster fix here would be to decode the prompt from utf-8 to utf-16-le in PyOS_StdioReadline and then write it using a wide-char output function.

----------
keywords: +3.5regression
stage:  -> needs patch
versions: +Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28333>
_______________________________________


More information about the Python-bugs-list mailing list