13094484106f79545262eb9c8604158a742cad56aGuido van Rossum#ifndef Py_CODECREGISTRY_H
23094484106f79545262eb9c8604158a742cad56aGuido van Rossum#define Py_CODECREGISTRY_H
33094484106f79545262eb9c8604158a742cad56aGuido van Rossum#ifdef __cplusplus
43094484106f79545262eb9c8604158a742cad56aGuido van Rossumextern "C" {
53094484106f79545262eb9c8604158a742cad56aGuido van Rossum#endif
63094484106f79545262eb9c8604158a742cad56aGuido van Rossum
73094484106f79545262eb9c8604158a742cad56aGuido van Rossum/* ------------------------------------------------------------------------
83094484106f79545262eb9c8604158a742cad56aGuido van Rossum
93094484106f79545262eb9c8604158a742cad56aGuido van Rossum   Python Codec Registry and support functions
103094484106f79545262eb9c8604158a742cad56aGuido van Rossum
113094484106f79545262eb9c8604158a742cad56aGuido van Rossum
123094484106f79545262eb9c8604158a742cad56aGuido van RossumWritten by Marc-Andre Lemburg (mal@lemburg.com).
133094484106f79545262eb9c8604158a742cad56aGuido van Rossum
1416b1ad9c7d431975353c06ad952237281e743b39Guido van RossumCopyright (c) Corporation for National Research Initiatives.
153094484106f79545262eb9c8604158a742cad56aGuido van Rossum
163094484106f79545262eb9c8604158a742cad56aGuido van Rossum   ------------------------------------------------------------------------ */
173094484106f79545262eb9c8604158a742cad56aGuido van Rossum
183ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake/* Register a new codec search function.
193ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
203ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   As side effect, this tries to load the encodings package, if not
213ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   yet done, to make sure that it is always first in the list of
223ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   search functions.
233ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
243ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   The search_function's refcount is incremented by this function. */
253ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
2691a681debf9ffec155d0aff8a0bb5f965f592e16Mark HammondPyAPI_FUNC(int) PyCodec_Register(
273094484106f79545262eb9c8604158a742cad56aGuido van Rossum       PyObject *search_function
283094484106f79545262eb9c8604158a742cad56aGuido van Rossum       );
293094484106f79545262eb9c8604158a742cad56aGuido van Rossum
30b2750b5d334e9c8d262009069bce41c15803eca0Marc-André Lemburg/* Codec registry lookup API.
313ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
32a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters   Looks up the given encoding and returns a CodecInfo object with
33a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters   function attributes which implement the different aspects of
34a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters   processing the encoding.
353ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
363ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   The encoding string is looked up converted to all lower-case
373ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   characters. This makes encodings looked up through this mechanism
383ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   effectively case-insensitive.
393ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
40a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters   If no codec is found, a KeyError is set and NULL returned.
413ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
423ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   As side effect, this tries to load the encodings package, if not
433ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   yet done. This is part of the lazy load strategy for the encodings
443ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   package.
453ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
463ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake */
473ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
484d0d471a8031de90a2b1ce99c4ac4780e60b3bc9Martin v. Löwis#ifndef Py_LIMITED_API
4991a681debf9ffec155d0aff8a0bb5f965f592e16Mark HammondPyAPI_FUNC(PyObject *) _PyCodec_Lookup(
503094484106f79545262eb9c8604158a742cad56aGuido van Rossum       const char *encoding
513094484106f79545262eb9c8604158a742cad56aGuido van Rossum       );
528fad1676a215bab3e61dccf0f1802ccb17a43a41Nick Coghlan
538fad1676a215bab3e61dccf0f1802ccb17a43a41Nick CoghlanPyAPI_FUNC(int) _PyCodec_Forget(
548fad1676a215bab3e61dccf0f1802ccb17a43a41Nick Coghlan       const char *encoding
558fad1676a215bab3e61dccf0f1802ccb17a43a41Nick Coghlan       );
564d0d471a8031de90a2b1ce99c4ac4780e60b3bc9Martin v. Löwis#endif
573094484106f79545262eb9c8604158a742cad56aGuido van Rossum
58b2750b5d334e9c8d262009069bce41c15803eca0Marc-André Lemburg/* Codec registry encoding check API.
59b2750b5d334e9c8d262009069bce41c15803eca0Marc-André Lemburg
60b2750b5d334e9c8d262009069bce41c15803eca0Marc-André Lemburg   Returns 1/0 depending on whether there is a registered codec for
61b2750b5d334e9c8d262009069bce41c15803eca0Marc-André Lemburg   the given encoding.
62b2750b5d334e9c8d262009069bce41c15803eca0Marc-André Lemburg
63b2750b5d334e9c8d262009069bce41c15803eca0Marc-André Lemburg*/
64b2750b5d334e9c8d262009069bce41c15803eca0Marc-André Lemburg
65b2750b5d334e9c8d262009069bce41c15803eca0Marc-André LemburgPyAPI_FUNC(int) PyCodec_KnownEncoding(
66b2750b5d334e9c8d262009069bce41c15803eca0Marc-André Lemburg       const char *encoding
67b2750b5d334e9c8d262009069bce41c15803eca0Marc-André Lemburg       );
68b2750b5d334e9c8d262009069bce41c15803eca0Marc-André Lemburg
693ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake/* Generic codec based encoding API.
703ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
713ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   object is passed through the encoder function found for the given
723ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   encoding using the error handling method defined by errors. errors
733ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   may be NULL to use the default method defined for the codec.
74009b811d678f36cf63be4fe26f3fbaa38aa0078eSerhiy Storchaka
753ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   Raises a LookupError in case no encoder can be found.
763ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
773ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake */
783ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
7991a681debf9ffec155d0aff8a0bb5f965f592e16Mark HammondPyAPI_FUNC(PyObject *) PyCodec_Encode(
803ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake       PyObject *object,
813ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake       const char *encoding,
823ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake       const char *errors
833ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake       );
843ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
853ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake/* Generic codec based decoding API.
863ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
873ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   object is passed through the decoder function found for the given
883ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   encoding using the error handling method defined by errors. errors
893ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   may be NULL to use the default method defined for the codec.
90009b811d678f36cf63be4fe26f3fbaa38aa0078eSerhiy Storchaka
913ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   Raises a LookupError in case no encoder can be found.
923ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
933ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake */
943ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
9591a681debf9ffec155d0aff8a0bb5f965f592e16Mark HammondPyAPI_FUNC(PyObject *) PyCodec_Decode(
963ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake       PyObject *object,
973ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake       const char *encoding,
983ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake       const char *errors
993ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake       );
1003ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
1011c0689c613b61c8944456e78c5b592e3aaa40abaMartin v. Löwis#ifndef Py_LIMITED_API
102c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan/* Text codec specific encoding and decoding API.
103c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan
104c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan   Checks the encoding against a list of codecs which do not
105c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan   implement a str<->bytes encoding before attempting the
106c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan   operation.
107c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan
108c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan   Please note that these APIs are internal and should not
109c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan   be used in Python C extensions.
110c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan
111a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan   XXX (ncoghlan): should we make these, or something like them, public
112a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan   in Python 3.5+?
113a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan
114c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan */
115a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick CoghlanPyAPI_FUNC(PyObject *) _PyCodec_LookupTextEncoding(
116a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan       const char *encoding,
117a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan       const char *alternate_command
118a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan       );
119c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan
120c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick CoghlanPyAPI_FUNC(PyObject *) _PyCodec_EncodeText(
121c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan       PyObject *object,
122c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan       const char *encoding,
123c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan       const char *errors
124c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan       );
125c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan
126c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick CoghlanPyAPI_FUNC(PyObject *) _PyCodec_DecodeText(
127c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan       PyObject *object,
128c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan       const char *encoding,
129c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan       const char *errors
130c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan       );
131a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan
132a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan/* These two aren't actually text encoding specific, but _io.TextIOWrapper
133a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan * is the only current API consumer.
134a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan */
135a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick CoghlanPyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalDecoder(
136a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan       PyObject *codec_info,
137a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan       const char *errors
138a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan       );
139a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan
140a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick CoghlanPyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder(
141a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan       PyObject *codec_info,
142a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan       const char *errors
143a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7Nick Coghlan       );
144c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan#endif
145c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan
146c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan
147c72e4e6dccce99bcdcb45959767436d7e5cfda8cNick Coghlan
148009b811d678f36cf63be4fe26f3fbaa38aa0078eSerhiy Storchaka/* --- Codec Lookup APIs --------------------------------------------------
1493ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
1503ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   All APIs return a codec object with incremented refcount and are
1513ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   based on _PyCodec_Lookup().  The same comments w/r to the encoding
1523ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake   name also apply to these APIs.
1533ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
1543ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake*/
1553ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
1563ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake/* Get an encoder function for the given encoding. */
1573ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
15891a681debf9ffec155d0aff8a0bb5f965f592e16Mark HammondPyAPI_FUNC(PyObject *) PyCodec_Encoder(
1593094484106f79545262eb9c8604158a742cad56aGuido van Rossum       const char *encoding
1603094484106f79545262eb9c8604158a742cad56aGuido van Rossum       );
1613094484106f79545262eb9c8604158a742cad56aGuido van Rossum
1623ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake/* Get a decoder function for the given encoding. */
1633ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
16491a681debf9ffec155d0aff8a0bb5f965f592e16Mark HammondPyAPI_FUNC(PyObject *) PyCodec_Decoder(
1653094484106f79545262eb9c8604158a742cad56aGuido van Rossum       const char *encoding
1663094484106f79545262eb9c8604158a742cad56aGuido van Rossum       );
1673094484106f79545262eb9c8604158a742cad56aGuido van Rossum
1687462b64911f1e2df2de2285ddbf8b156b5cdc418Martin Panter/* Get an IncrementalEncoder object for the given encoding. */
169a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters
170a977329b6fb0e4c95cabb9043794de69b27a1099Thomas WoutersPyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder(
171a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters       const char *encoding,
172a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters       const char *errors
173a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters       );
174a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters
1757462b64911f1e2df2de2285ddbf8b156b5cdc418Martin Panter/* Get an IncrementalDecoder object function for the given encoding. */
176a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters
177a977329b6fb0e4c95cabb9043794de69b27a1099Thomas WoutersPyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder(
178a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters       const char *encoding,
179a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters       const char *errors
180a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters       );
181a977329b6fb0e4c95cabb9043794de69b27a1099Thomas Wouters
1823ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake/* Get a StreamReader factory function for the given encoding. */
1833ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake
18491a681debf9ffec155d0aff8a0bb5f965f592e16Mark HammondPyAPI_FUNC(PyObject *) PyCodec_StreamReader(
1853094484106f79545262eb9c8604158a742cad56aGuido van Rossum       const char *encoding,
1863094484106f79545262eb9c8604158a742cad56aGuido van Rossum       PyObject *stream,
1873094484106f79545262eb9c8604158a742cad56aGuido van Rossum       const char *errors
1883094484106f79545262eb9c8604158a742cad56aGuido van Rossum       );
1893094484106f79545262eb9c8604158a742cad56aGuido van Rossum
1903ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake/* Get a StreamWriter factory function for the given encoding. */
1913094484106f79545262eb9c8604158a742cad56aGuido van Rossum
19291a681debf9ffec155d0aff8a0bb5f965f592e16Mark HammondPyAPI_FUNC(PyObject *) PyCodec_StreamWriter(
1933094484106f79545262eb9c8604158a742cad56aGuido van Rossum       const char *encoding,
1943ac3edcf95c5acd1644951e90bde9b0436f61fd7Fred Drake       PyObject *stream,
1953094484106f79545262eb9c8604158a742cad56aGuido van Rossum       const char *errors
1963094484106f79545262eb9c8604158a742cad56aGuido van Rossum       );
1973094484106f79545262eb9c8604158a742cad56aGuido van Rossum
1983aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald/* Unicode encoding error handling callback registry API */
1993aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald
200bab3378f365b97db1ce7a3d497b0e2b89fb5a577Georg Brandl/* Register the error handling callback function error under the given
2013aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald   name. This function will be called by the codec when it encounters
2023aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald   unencodable characters/undecodable bytes and doesn't know the
2033aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald   callback name, when name is specified as the error parameter
2043aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald   in the call to the encode/decode function.
2053aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald   Return 0 on success, -1 on error */
2063aeb632c3152fa082132ce55b9a880e0d16b04aeWalter DörwaldPyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error);
2073aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald
208bab3378f365b97db1ce7a3d497b0e2b89fb5a577Georg Brandl/* Lookup the error handling callback function registered under the given
209bab3378f365b97db1ce7a3d497b0e2b89fb5a577Georg Brandl   name. As a special case NULL can be passed, in which case
2103aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald   the error handling callback for "strict" will be returned. */
2113aeb632c3152fa082132ce55b9a880e0d16b04aeWalter DörwaldPyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name);
2123aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald
2133aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald/* raise exc as an exception */
2143aeb632c3152fa082132ce55b9a880e0d16b04aeWalter DörwaldPyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc);
2153aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald
2163aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald/* ignore the unicode error, skipping the faulty input */
2173aeb632c3152fa082132ce55b9a880e0d16b04aeWalter DörwaldPyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc);
2183aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald
219bab3378f365b97db1ce7a3d497b0e2b89fb5a577Georg Brandl/* replace the unicode encode error with ? or U+FFFD */
2203aeb632c3152fa082132ce55b9a880e0d16b04aeWalter DörwaldPyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc);
2213aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald
2223aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald/* replace the unicode encode error with XML character references */
2233aeb632c3152fa082132ce55b9a880e0d16b04aeWalter DörwaldPyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc);
2243aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald
2253aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald/* replace the unicode encode error with backslash escapes (\x, \u and \U) */
2263aeb632c3152fa082132ce55b9a880e0d16b04aeWalter DörwaldPyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc);
2273aeb632c3152fa082132ce55b9a880e0d16b04aeWalter Dörwald
22834d0ac8027e23609e24588735b37b8d5a55f7223Serhiy Storchaka#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
229166ebc4e5dd09f005c6144b7568da83728b8b893Serhiy Storchaka/* replace the unicode encode error with backslash escapes (\N, \x, \u and \U) */
230166ebc4e5dd09f005c6144b7568da83728b8b893Serhiy StorchakaPyAPI_FUNC(PyObject *) PyCodec_NameReplaceErrors(PyObject *exc);
23134d0ac8027e23609e24588735b37b8d5a55f7223Serhiy Storchaka#endif
232166ebc4e5dd09f005c6144b7568da83728b8b893Serhiy Storchaka
23334d0ac8027e23609e24588735b37b8d5a55f7223Serhiy Storchaka#ifndef Py_LIMITED_API
234e60698317dc7772983784037d966d24d1d30dc87Antoine PitrouPyAPI_DATA(const char *) Py_hexdigits;
23534d0ac8027e23609e24588735b37b8d5a55f7223Serhiy Storchaka#endif
236f5cff56a1be70d2c4e5cde5fa4e5d5d92e620ddaVictor Stinner
2373094484106f79545262eb9c8604158a742cad56aGuido van Rossum#ifdef __cplusplus
2383094484106f79545262eb9c8604158a742cad56aGuido van Rossum}
2393094484106f79545262eb9c8604158a742cad56aGuido van Rossum#endif
2403094484106f79545262eb9c8604158a742cad56aGuido van Rossum#endif /* !Py_CODECREGISTRY_H */
241