[issue8438] Codecs: "surrogateescape" error handler in Python 2.7
Ray.Allen
report at bugs.python.org
Sun Apr 18 10:25:33 CEST 2010
New submission from Ray.Allen <ysj.ray at gmail.com>:
According to PEP 383, the new "surrogateescape" error handler of codecs should begin to appear since Python3.1, but in the trunk I found some code have already used it:
Modules/_io/fileio.c:
static int
fileio_init(PyObject *oself, PyObject *args, PyObject *kwds){
...
stringobj = PyUnicode_AsEncodedString(
u, Py_FileSystemDefaultEncoding, "surrogateescape");
...
Obviously, the "surrogateescape" error handler not exists.
Some test code:
===========================
import io
file_name = u'\udc80.txt'
f = io.FileIO(file_name)
===========================
When run this piece of code on a machine whose file system default encoding is gb2312, will raise an exception:
LookupError: unknown error handler name 'surrogateescape'
I don't know weather this is a bug?
Thanks.
----------
components: Unicode
messages: 103470
nosy: loewis, ysj.ray
severity: normal
status: open
title: Codecs: "surrogateescape" error handler in Python 2.7
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8438>
_______________________________________
More information about the Python-bugs-list
mailing list