diff options
author | Walter Dörwald <walter@livinglogic.de> | 2002-09-02 13:14:32 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2002-09-02 13:14:32 (GMT) |
commit | 3aeb632c3152fa082132ce55b9a880e0d16b04ae (patch) | |
tree | 192bc1543ea77a826d0c940d024dbc8ebba82156 /Include/codecs.h | |
parent | 94fab762de532de551987e1f48a125145f85304b (diff) | |
download | cpython-3aeb632c3152fa082132ce55b9a880e0d16b04ae.zip cpython-3aeb632c3152fa082132ce55b9a880e0d16b04ae.tar.gz cpython-3aeb632c3152fa082132ce55b9a880e0d16b04ae.tar.bz2 |
PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Diffstat (limited to 'Include/codecs.h')
-rw-r--r-- | Include/codecs.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Include/codecs.h b/Include/codecs.h index 2cc4d7d..82f18cd 100644 --- a/Include/codecs.h +++ b/Include/codecs.h @@ -117,6 +117,36 @@ PyAPI_FUNC(PyObject *) PyCodec_StreamWriter( const char *errors ); +/* Unicode encoding error handling callback registry API */ + +/* Register the error handling callback function error under the name + name. This function will be called by the codec when it encounters + unencodable characters/undecodable bytes and doesn't know the + callback name, when name is specified as the error parameter + in the call to the encode/decode function. + Return 0 on success, -1 on error */ +PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error); + +/* Lookup the error handling callback function registered under the + name error. As a special case NULL can be passed, in which case + the error handling callback for "strict" will be returned. */ +PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name); + +/* raise exc as an exception */ +PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc); + +/* ignore the unicode error, skipping the faulty input */ +PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc); + +/* replace the unicode error with ? or U+FFFD */ +PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc); + +/* replace the unicode encode error with XML character references */ +PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc); + +/* replace the unicode encode error with backslash escapes (\x, \u and \U) */ +PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc); + #ifdef __cplusplus } #endif |