Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
69f2b46d
Commit
69f2b46d
authored
Nov 19, 2002
by
Walter Dörwald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing documentation for the PEP 293 functionality to
the codecs docstrings.
parent
6d7d4230
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
Lib/codecs.py
Lib/codecs.py
+22
-7
No files found.
Lib/codecs.py
View file @
69f2b46d
...
...
@@ -67,15 +67,22 @@ class Codec:
""" Defines the interface for stateless encoders/decoders.
The .encode()/.decode() methods may
implement
different error
The .encode()/.decode() methods may
use
different error
handling schemes by providing the errors argument. These
string values are defined:
string values are
pre
defined:
'strict' - raise a ValueError error (or a subclass)
'ignore' - ignore the character and continue with the next
'replace' - replace with a suitable replacement character;
Python will use the official U+FFFD REPLACEMENT
CHARACTER for the builtin Unicode codecs.
CHARACTER for the builtin Unicode codecs on
decoding and '?' on encoding.
'xmlcharrefreplace' - Replace with the appropriate XML
character reference (only for encoding).
'backslashreplace' - Replace with backslashed escape sequences
(only for encoding).
The set of allowed values can be extended via register_error.
"""
def
encode
(
self
,
input
,
errors
=
'strict'
):
...
...
@@ -136,14 +143,20 @@ class StreamWriter(Codec):
stream must be a file-like object open for writing
(binary) data.
The StreamWriter may
implement
different error handling
The StreamWriter may
use
different error handling
schemes by providing the errors keyword argument. These
parameters are defined:
parameters are
pre
defined:
'strict' - raise a ValueError (or a subclass)
'ignore' - ignore the character and continue with the next
'replace'- replace with a suitable replacement character
'xmlcharrefreplace' - Replace with the appropriate XML
character reference.
'backslashreplace' - Replace with backslashed escape
sequences (only for encoding).
The set of allowed parameter values can be extended via
register_error.
"""
self
.
stream
=
stream
self
.
errors
=
errors
...
...
@@ -192,14 +205,16 @@ class StreamReader(Codec):
stream must be a file-like object open for reading
(binary) data.
The StreamReader may
implement
different error handling
The StreamReader may
use
different error handling
schemes by providing the errors keyword argument. These
parameters are defined:
parameters are
pre
defined:
'strict' - raise a ValueError (or a subclass)
'ignore' - ignore the character and continue with the next
'replace'- replace with a suitable replacement character;
The set of allowed parameter values can be extended via
register_error.
"""
self
.
stream
=
stream
self
.
errors
=
errors
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment