summaryrefslogtreecommitdiffstats
path: root/Doc/library/codecs.rst
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2013-10-13 14:55:46 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2013-10-13 14:55:46 (GMT)
commite206b6e10ef051da924769ab0b449f0932c1a344 (patch)
tree984834a487f9aa6af2931d39b7284027f80bfa11 /Doc/library/codecs.rst
parent5983258bf238367e621cae346fce883f934a07a1 (diff)
parent6cb2b5b1e1ded4c10e305e493e016a7ccf0275cd (diff)
downloadcpython-e206b6e10ef051da924769ab0b449f0932c1a344.zip
cpython-e206b6e10ef051da924769ab0b449f0932c1a344.tar.gz
cpython-e206b6e10ef051da924769ab0b449f0932c1a344.tar.bz2
Issue #17827: document codecs.encode and codecs.decode
- Merge from 3.3 - Added to What's New since these are more important in 3.x, as the bytes<->bytes and str<->str codecs don't fit the text model convenience methods in 3.x the way they did the basestring<->basestring methods in the 2.x text model - Included under Library in Misc/NEWS for the same reason
Diffstat (limited to 'Doc/library/codecs.rst')
-rw-r--r--Doc/library/codecs.rst19
1 files changed, 19 insertions, 0 deletions
diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst
index b412038..b6d4f08 100644
--- a/Doc/library/codecs.rst
+++ b/Doc/library/codecs.rst
@@ -22,6 +22,25 @@ manages the codec and error handling lookup process.
It defines the following functions:
+.. function:: encode(obj, encoding='utf-8', errors='strict')
+
+ Encodes *obj* using the codec registered for *encoding*.
+
+ *Errors* may be given to set the desired error handling scheme. The
+ default error handler is ``strict`` meaning that encoding errors raise
+ :exc:`ValueError` (or a more codec specific subclass, such as
+ :exc:`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more
+ information on codec error handling.
+
+.. function:: decode(obj, encoding='utf-8', errors='strict')
+
+ Decodes *obj* using the codec registered for *encoding*.
+
+ *Errors* may be given to set the desired error handling scheme. The
+ default error handler is ``strict`` meaning that decoding errors raise
+ :exc:`ValueError` (or a more codec specific subclass, such as
+ :exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more
+ information on codec error handling.
.. function:: register(search_function)