summaryrefslogtreecommitdiffstats
path: root/Doc/lib
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2004-07-01 19:58:47 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2004-07-01 19:58:47 (GMT)
commitac1075a645e2c0bb26b1d5fbab0df0afa09d59a2 (patch)
tree6c5ff0a75cf945722fe7c6f264b5f08b2ed21899 /Doc/lib
parentecf7a52bb8139f054e024bae184244311005b90f (diff)
downloadcpython-ac1075a645e2c0bb26b1d5fbab0df0afa09d59a2.zip
cpython-ac1075a645e2c0bb26b1d5fbab0df0afa09d59a2.tar.gz
cpython-ac1075a645e2c0bb26b1d5fbab0df0afa09d59a2.tar.bz2
Document that encode() and decode() raise UnicodeError
instead of ValueError. Add a note about error handling schemes added by PEP 293.
Diffstat (limited to 'Doc/lib')
-rw-r--r--Doc/lib/libstdtypes.tex15
1 files changed, 10 insertions, 5 deletions
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex
index 5af8a7c..66e5702 100644
--- a/Doc/lib/libstdtypes.tex
+++ b/Doc/lib/libstdtypes.tex
@@ -567,9 +567,11 @@ Decodes the string using the codec registered for \var{encoding}.
\var{encoding} defaults to the default string encoding. \var{errors}
may be given to set a different error handling scheme. The default is
\code{'strict'}, meaning that encoding errors raise
-\exception{ValueError}. Other possible values are \code{'ignore'} and
-\code{'replace'}.
+\exception{UnicodeError}. Other possible values are \code{'ignore'},
+\code{'replace'} and any other name registered via
+\function{codecs.register_error}.
\versionadded{2.2}
+\versionchanged[Support for other error handling schemes added]{2.3}
\end{methoddesc}
\begin{methoddesc}[string]{encode}{\optional{encoding\optional{,errors}}}
@@ -577,10 +579,13 @@ Return an encoded version of the string. Default encoding is the current
default string encoding. \var{errors} may be given to set a different
error handling scheme. The default for \var{errors} is
\code{'strict'}, meaning that encoding errors raise a
-\exception{ValueError}. Other possible values are \code{'ignore'} and
-\code{'replace'}. For a list of possible encodings, see
-section~\ref{standard-encodings}.
+\exception{UnicodeError}. Other possible values are \code{'ignore'},
+\code{'replace'}, \code{'xmlcharrefreplace'}, \code{'backslashreplace'}
+and any other name registered via \function{codecs.register_error}.
+For a list of possible encodings, see section~\ref{standard-encodings}.
\versionadded{2.0}
+\versionchanged[Support for \code{'xmlcharrefreplace'} and
+\code{'backslashreplace'} and other error handling schemes added]{2.3}
\end{methoddesc}
\begin{methoddesc}[string]{endswith}{suffix\optional{, start\optional{, end}}}