[Python-checkins] r85339 - in python/branches/py3k/Doc: c-api/unicode.rst library/os.rst
victor.stinner
python-checkins at python.org
Sat Oct 9 12:34:37 CEST 2010
Author: victor.stinner
Date: Sat Oct 9 12:34:37 2010
New Revision: 85339
Log:
Document that the 'strict' error handler is used to encode/decode filenames on
Windows
Modified:
python/branches/py3k/Doc/c-api/unicode.rst
python/branches/py3k/Doc/library/os.rst
Modified: python/branches/py3k/Doc/c-api/unicode.rst
==============================================================================
--- python/branches/py3k/Doc/c-api/unicode.rst (original)
+++ python/branches/py3k/Doc/c-api/unicode.rst Sat Oct 9 12:34:37 2010
@@ -412,26 +412,33 @@
.. c:function:: PyObject* PyUnicode_DecodeFSDefaultAndSize(const char *s, Py_ssize_t size)
- Decode a null-terminated string using :c:data:`Py_FileSystemDefaultEncoding`
- and the ``"surrogateescape"`` error handler.
+ Decode a string using :c:data:`Py_FileSystemDefaultEncoding` and the
+ ``'surrogateescape'`` error handler, or ``'strict'`` on Windows.
If :c:data:`Py_FileSystemDefaultEncoding` is not set, fall back to UTF-8.
- Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` if you know the string length.
+ .. versionchanged:: 3.2
+ Use ``'strict'`` error handler on Windows.
.. c:function:: PyObject* PyUnicode_DecodeFSDefault(const char *s)
- Decode a string using :c:data:`Py_FileSystemDefaultEncoding` and
- the ``"surrogateescape"`` error handler.
+ Decode a null-terminated string using :c:data:`Py_FileSystemDefaultEncoding`
+ and the ``'surrogateescape'`` error handler, or ``'strict'`` on Windows.
If :c:data:`Py_FileSystemDefaultEncoding` is not set, fall back to UTF-8.
+ Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` if you know the string length.
+
+ .. versionchanged:: 3.2
+ Use ``'strict'`` error handler on Windows.
+
.. c:function:: PyObject* PyUnicode_EncodeFSDefault(PyObject *unicode)
Encode a Unicode object to :c:data:`Py_FileSystemDefaultEncoding` with the
- ``'surrogateescape'`` error handler, and return :class:`bytes`.
+ ``'surrogateescape'`` error handler, or ``'strict'`` on Windows, and return
+ :class:`bytes`.
If :c:data:`Py_FileSystemDefaultEncoding` is not set, fall back to UTF-8.
Modified: python/branches/py3k/Doc/library/os.rst
==============================================================================
--- python/branches/py3k/Doc/library/os.rst (original)
+++ python/branches/py3k/Doc/library/os.rst Sat Oct 9 12:34:37 2010
@@ -158,9 +158,7 @@
.. function:: fsencode(filename)
Encode *filename* to the filesystem encoding with ``'surrogateescape'``
- error handler, return :class:`bytes` unchanged. On Windows, use ``'strict'``
- error handler if the filesystem encoding is ``'mbcs'`` (which is the default
- encoding).
+ error handler, or ``'strict'`` on Windows; return :class:`bytes` unchanged.
:func:`fsdecode` is the reverse function.
@@ -170,9 +168,7 @@
.. function:: fsdecode(filename)
Decode *filename* from the filesystem encoding with ``'surrogateescape'``
- error handler, return :class:`str` unchanged. On Windows, use ``'strict'``
- error handler if the filesystem encoding is ``'mbcs'`` (which is the default
- encoding).
+ error handler, or ``'strict'`` on Windows; return :class:`str` unchanged.
:func:`fsencode` is the reverse function.
More information about the Python-checkins
mailing list