mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Merge issue 19548 changes from 3.4
This commit is contained in:
commit
582acb75e9
9 changed files with 432 additions and 385 deletions
File diff suppressed because it is too large
Load diff
|
@ -940,15 +940,17 @@ are always available. They are listed here in alphabetical order.
|
|||
*encoding* is the name of the encoding used to decode or encode the file.
|
||||
This should only be used in text mode. The default encoding is platform
|
||||
dependent (whatever :func:`locale.getpreferredencoding` returns), but any
|
||||
encoding supported by Python can be used. See the :mod:`codecs` module for
|
||||
:term:`text encoding` supported by Python
|
||||
can be used. See the :mod:`codecs` module for
|
||||
the list of supported encodings.
|
||||
|
||||
*errors* is an optional string that specifies how encoding and decoding
|
||||
errors are to be handled--this cannot be used in binary mode.
|
||||
A variety of standard error handlers are available, though any
|
||||
A variety of standard error handlers are available
|
||||
(listed under :ref:`error-handlers`), though any
|
||||
error handling name that has been registered with
|
||||
:func:`codecs.register_error` is also valid. The standard names
|
||||
are:
|
||||
include:
|
||||
|
||||
* ``'strict'`` to raise a :exc:`ValueError` exception if there is
|
||||
an encoding error. The default value of ``None`` has the same
|
||||
|
|
|
@ -1512,7 +1512,7 @@ expression support in the :mod:`re` module).
|
|||
a :exc:`UnicodeError`. Other possible
|
||||
values are ``'ignore'``, ``'replace'``, ``'xmlcharrefreplace'``,
|
||||
``'backslashreplace'`` and any other name registered via
|
||||
:func:`codecs.register_error`, see section :ref:`codec-base-classes`. For a
|
||||
:func:`codecs.register_error`, see section :ref:`error-handlers`. For a
|
||||
list of possible encodings, see section :ref:`standard-encodings`.
|
||||
|
||||
.. versionchanged:: 3.1
|
||||
|
@ -2384,7 +2384,7 @@ arbitrary binary data.
|
|||
error handling scheme. The default for *errors* is ``'strict'``, meaning
|
||||
that encoding errors raise a :exc:`UnicodeError`. Other possible values are
|
||||
``'ignore'``, ``'replace'`` and any other name registered via
|
||||
:func:`codecs.register_error`, see section :ref:`codec-base-classes`. For a
|
||||
:func:`codecs.register_error`, see section :ref:`error-handlers`. For a
|
||||
list of possible encodings, see section :ref:`standard-encodings`.
|
||||
|
||||
.. note::
|
||||
|
|
|
@ -798,7 +798,7 @@ metadata must be either decoded or encoded. If *encoding* is not set
|
|||
appropriately, this conversion may fail.
|
||||
|
||||
The *errors* argument defines how characters are treated that cannot be
|
||||
converted. Possible values are listed in section :ref:`codec-base-classes`.
|
||||
converted. Possible values are listed in section :ref:`error-handlers`.
|
||||
The default scheme is ``'surrogateescape'`` which Python also uses for its
|
||||
file system calls, see :ref:`os-filenames`.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue