]> granicus.if.org Git - python/commitdiff
Issue #17827: Document codecs.encode and codecs.decode
authorNick Coghlan <ncoghlan@gmail.com>
Sun, 13 Oct 2013 14:22:13 +0000 (00:22 +1000)
committerNick Coghlan <ncoghlan@gmail.com>
Sun, 13 Oct 2013 14:22:13 +0000 (00:22 +1000)
Doc/library/codecs.rst
Misc/NEWS

index a5a27a2159d94db1d7fa491e363e2534fa108410..004f5c784c6d2647f2b2139857091eefaa64128e 100644 (file)
@@ -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)
 
index 536ea0eec9b58a81fb648ab6c2c877a01ac42d29..e764376a552eb63285d48e07b665ea3f3ee45e27 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -76,6 +76,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #17827: Add the missing documentation for ``codecs.encode`` and
+  ``codecs.decode``.
+
 - Issue #18458: Prevent crashes with newer versions of libedit.  Its readline
   emulation has changed from 0-based indexing to 1-based like gnu readline.
   Original patch by Ronald Oussoren.