aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-01-25 22:56:57 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2015-01-25 22:56:57 +0200
commit07985ef387a87486a0e632844be03a8877e7f889 (patch)
treeb89d636e8ba7b0cd170064698741aebb46951eb5 /Lib/codecs.py
parentMerge: #23215: note that time.sleep affects the current thread only. (diff)
downloadcpython-07985ef387a87486a0e632844be03a8877e7f889.tar.gz
cpython-07985ef387a87486a0e632844be03a8877e7f889.tar.bz2
cpython-07985ef387a87486a0e632844be03a8877e7f889.zip
Issue #22286: The "backslashreplace" error handlers now works with
decoding and translating.
Diffstat (limited to 'Lib/codecs.py')
-rw-r--r--Lib/codecs.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/codecs.py b/Lib/codecs.py
index 7439b9f159e..c2b5d6c35c6 100644
--- a/Lib/codecs.py
+++ b/Lib/codecs.py
@@ -127,7 +127,8 @@ class Codec:
'surrogateescape' - replace with private code points U+DCnn.
'xmlcharrefreplace' - Replace with the appropriate XML
character reference (only for encoding).
- 'backslashreplace' - Replace with backslashed escape sequences
+ 'backslashreplace' - Replace with backslashed escape sequences.
+ 'namereplace' - Replace with \\N{...} escape sequences
(only for encoding).
The set of allowed values can be extended via register_error.
@@ -359,7 +360,8 @@ class StreamWriter(Codec):
'xmlcharrefreplace' - Replace with the appropriate XML
character reference.
'backslashreplace' - Replace with backslashed escape
- sequences (only for encoding).
+ sequences.
+ 'namereplace' - Replace with \\N{...} escape sequences.
The set of allowed parameter values can be extended via
register_error.
@@ -429,7 +431,8 @@ class StreamReader(Codec):
'strict' - raise a ValueError (or a subclass)
'ignore' - ignore the character and continue with the next
- 'replace'- replace with a suitable replacement character;
+ 'replace'- replace with a suitable replacement character
+ 'backslashreplace' - Replace with backslashed escape sequences;
The set of allowed parameter values can be extended via
register_error.