[Python-checkins] r62401 - python/trunk/Doc/library/io.rst
benjamin.peterson
python-checkins at python.org
Sat Apr 19 21:47:34 CEST 2008
Author: benjamin.peterson
Date: Sat Apr 19 21:47:34 2008
New Revision: 62401
Log:
Complete documentation for errors argument of io's open and TextIOWrapper
Modified:
python/trunk/Doc/library/io.rst
Modified: python/trunk/Doc/library/io.rst
==============================================================================
--- python/trunk/Doc/library/io.rst (original)
+++ python/trunk/Doc/library/io.rst Sat Apr 19 21:47:34 2008
@@ -102,13 +102,15 @@
: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 argument should not be used in binary mode.
- Pass ``'strict'`` to raise a :exc:`ValueError` exception if there is an
- encoding error (the default of ``None`` has the same effect), or pass
- ``'ignore'`` to ignore errors. (Note that ignoring encoding errors can lead
- to data loss.) ``'replace'`` causes a replacement marker (such as ``'?'``)
- to be inserted where there is malformed data. For all possible values, see
- :func:`codecs.register`.
+ errors are to be handled. Pass ``'strict'`` to raise a :exc:`ValueError`
+ exception if there is an encoding error (the default of ``None`` has the same
+ effect), or pass ``'ignore'`` to ignore errors. (Note that ignoring encoding
+ errors can lead to data loss.) ``'replace'`` causes a replacement marker
+ (such as ``'?'``) to be inserted where there is malformed data. When
+ writing, ``'xmlcharrefreplace'`` (replace with the appropriate XML character
+ reference) or ``'backslashreplace'`` (replace with backslashed escape
+ sequences) can be used. Any other error handling name that has been
+ registered with :func:`codecs.register_error` is also valid.
*newline* controls how universal newlines works (it only applies to text
mode). It can be ``None``, ``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``. It
@@ -582,8 +584,11 @@
exception if there is an encoding error (the default of ``None`` has the same
effect), or pass ``'ignore'`` to ignore errors. (Note that ignoring encoding
errors can lead to data loss.) ``'replace'`` causes a replacement marker
- (such as ``'?'``) to be inserted where there is malformed data. For all
- possible values see :func:`codecs.register`.
+ (such as ``'?'``) to be inserted where there is malformed data. When
+ writing, ``'xmlcharrefreplace'`` (replace with the appropriate XML character
+ reference) or ``'backslashreplace'`` (replace with backslashed escape
+ sequences) can be used. Any other error handling name that has been
+ registered with :func:`codecs.register_error` is also valid.
*newline* can be ``None``, ``''``, ``'\n'``, ``'\r'``, or ``'\r\n'``. It
controls the handling of line endings. If it is ``None``, universal newlines
More information about the Python-checkins
mailing list