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.

Author ysj.ray
Recipients loewis, ysj.ray
Date 2010-04-18.08:25:30
SpamBayes Score 2.7031826e-08
Marked as misclassified No
Message-id <1271579133.48.0.14681438148.issue8438@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-04-18 08:25:33ysj.raysetrecipients: + ysj.ray, loewis
2010-04-18 08:25:33ysj.raysetmessageid: <1271579133.48.0.14681438148.issue8438@psf.upfronthosting.co.za>
2010-04-18 08:25:31ysj.raylinkissue8438 messages
2010-04-18 08:25:30ysj.raycreate