Mercurial > cpython-lru_cache-weakref
diff Include/unicodeobject.h @ 61577:2b0af69aef97 3.1
Merged revisions 81168 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r81168 | victor.stinner | 2010-05-14 17:58:55 +0200 (ven., 14 mai 2010) | 10 lines
Issue #8711: Document PyUnicode_DecodeFSDefault*() functions
* Add paragraph titles to c-api/unicode.rst.
* Fix PyUnicode_DecodeFSDefault*() comment: it now uses the "surrogateescape"
error handler (and not "replace")
* Remove "The function is intended to be used for paths and file names only
during bootstrapping process where the codecs are not set up." from
PyUnicode_FSConverter() comment: it is used after the bootstrapping and for
other purposes than file names
........
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Fri, 14 May 2010 16:08:46 +0000 |
| parents | f197407bdba2 |
| children | c9879b3402e4 |
line wrap: on
line diff
--- a/Include/unicodeobject.h Fri May 14 01:33:36 2010 +0000 +++ b/Include/unicodeobject.h Fri May 14 16:08:46 2010 +0000 @@ -1238,25 +1238,29 @@ /* --- File system encoding ---------------------------------------------- */ /* ParseTuple converter which converts a Unicode object into the file - system encoding, using the PEP 383 error handler; bytes objects are - output as-is. */ + system encoding as a bytes object, using the "surrogateescape" error + handler; bytes objects are output as-is. */ PyAPI_FUNC(int) PyUnicode_FSConverter(PyObject*, void*); -/* Decode a null-terminated string using Py_FileSystemDefaultEncoding. +/* Decode a null-terminated string using Py_FileSystemDefaultEncoding + and the "surrogateescape" error handler. - If the encoding is supported by one of the built-in codecs (i.e., UTF-8, - UTF-16, UTF-32, Latin-1 or MBCS), otherwise fallback to UTF-8 and replace - invalid characters with '?'. + If Py_FileSystemDefaultEncoding is not set, fall back to UTF-8. - The function is intended to be used for paths and file names only - during bootstrapping process where the codecs are not set up. + Use PyUnicode_DecodeFSDefaultAndSize() if you have the string length. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefault( const char *s /* encoded string */ ); +/* Decode a string using Py_FileSystemDefaultEncoding + and the "surrogateescape" error handler. + + If Py_FileSystemDefaultEncoding is not set, fall back to UTF-8. +*/ + PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefaultAndSize( const char *s, /* encoded string */ Py_ssize_t size /* size */
