[issue8438] Codecs: "surrogateescape" error handler in Python 2.7

STINNER Victor report at bugs.python.org
Sun Apr 18 20:20:17 CEST 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

> I think it would be best to backport the handler (even though 
> it is not needed in Python 2.7), since it makes porting apps 
> to 3.x easier.

surrogateescape should not be used directly be applications. It's used by Python3 internals using unicode by default.

I don't know if it's would help porting applications from Python2 to Python3. I don't know a use case of surrogateescape in Python2. By default, Python2 uses byte string everywhere, especially for filenames, and so it doesn't need any unicode error handler.

Another point to consider is that utf8 encoder rejects surrogates in Python3, whereas surrogates are accepted by the Python2 utf8 encoder.

I don't have a strong opinion. But if I have to choose, I would say that surrogateescape should not go to Python2. It's a solution to problem specific to Python3.

(... and surrogates introduces a lot of new issues ...)

----------
nosy: +haypo

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


More information about the Python-bugs-list mailing list