diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-04-19 19:47:34 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-04-19 19:47:34 (GMT) |
commit | a7d09031a0d8d9e9a73d88332b3dd2c95050dd39 (patch) | |
tree | a2f4148686a05ba7f758eae411233443d8b74c89 /Doc/library/io.rst | |
parent | a1293eb65f2237c3783a9bf9ba9ff5557cd384b0 (diff) | |
download | cpython-a7d09031a0d8d9e9a73d88332b3dd2c95050dd39.zip cpython-a7d09031a0d8d9e9a73d88332b3dd2c95050dd39.tar.gz cpython-a7d09031a0d8d9e9a73d88332b3dd2c95050dd39.tar.bz2 |
Complete documentation for errors argument of io's open and TextIOWrapper
Diffstat (limited to 'Doc/library/io.rst')
-rw-r--r-- | Doc/library/io.rst | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst index 2e23653..97f354a 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -102,13 +102,15 @@ Module Interface :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 @@ Text I/O 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 |