[issue13342] input() builtin always uses "strict" error handler
report at bugs.python.org
Fri Nov 4 15:37:14 CET 2011
New submission from stefanholek <stefan at epy.co.at>:
The input builtin always uses "strict" error handling for Unicode conversions. This means that when I enter a latin-1 string in a utf-8 environment, input breaks with a UnicodeDecodeError. Now don't tell me not to do that, I have a valid use-case. ;-)
While "strict" may be a good default choice, it is clearly not sufficient. I would like to propose an optional 'errors' argument to input, similar to the 'errors' argument the decode and encode methods have.
I have in fact implemented such an input method for my own use:
While this solves my immediate needs, the fact that my implementation is basically just a copy of bltinmode.input with one additional argument, makes me think that this could be fixed in Python proper.
There cannot be a reason input() should be confined to "strict", or can there? ;-)
nosy: ezio.melotti, stefanholek
title: input() builtin always uses "strict" error handler
versions: Python 3.2, Python 3.3, Python 3.4
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list