mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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
This commit is contained in:
commit
e206b6e10e
3 changed files with 35 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue