mirror of
https://github.com/python/cpython.git
synced 2025-08-29 13:15:11 +00:00
Issue #12281: Rewrite the MBCS codec to handle correctly replace and ignore
error handlers on all Windows versions. The MBCS codec is now supporting all error handlers, instead of only replace to encode and ignore to decode.
This commit is contained in:
parent
1e73a2467f
commit
3a50e7056e
8 changed files with 893 additions and 152 deletions
|
@ -1466,6 +1466,14 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCSStateful(
|
|||
Py_ssize_t *consumed /* bytes consumed */
|
||||
);
|
||||
|
||||
PyAPI_FUNC(PyObject*) PyUnicode_DecodeCodePageStateful(
|
||||
int code_page, /* code page number */
|
||||
const char *string, /* encoded string */
|
||||
Py_ssize_t length, /* size of string */
|
||||
const char *errors, /* error handling */
|
||||
Py_ssize_t *consumed /* bytes consumed */
|
||||
);
|
||||
|
||||
PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString(
|
||||
PyObject *unicode /* Unicode object */
|
||||
);
|
||||
|
@ -1473,11 +1481,17 @@ PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString(
|
|||
#ifndef Py_LIMITED_API
|
||||
PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS(
|
||||
const Py_UNICODE *data, /* Unicode char buffer */
|
||||
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
|
||||
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
|
||||
const char *errors /* error handling */
|
||||
);
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(PyObject*) PyUnicode_EncodeCodePage(
|
||||
int code_page, /* code page number */
|
||||
PyObject *unicode, /* Unicode object */
|
||||
const char *errors /* error handling */
|
||||
);
|
||||
|
||||
#endif /* HAVE_MBCS */
|
||||
|
||||
/* --- Decimal Encoder ---------------------------------------------------- */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue