@@ -227,14 +227,21 @@ \subsection{Codec Base Classes}
227227codecs:
228228
229229\begin {tableii }{l|l}{code}{Value}{Meaning}
230- \lineii {'strict'}{Raise \exception {ValueError } (or a subclass);
230+ \lineii {'strict'}{Raise \exception {UnicodeError } (or a subclass);
231231 this is the default.}
232232 \lineii {'ignore'}{Ignore the character and continue with the next.}
233233 \lineii {'replace'}{Replace with a suitable replacement character;
234234 Python will use the official U+FFFD REPLACEMENT
235- CHARACTER for the built-in Unicode codecs.}
235+ CHARACTER for the built-in Unicode codecs on
236+ decoding and '?' on encoding.}
237+ \lineii {'xmlcharrefreplace'}{Replace with the appropriate XML
238+ character reference (only for encoding).}
239+ \lineii {'backslashreplace'}{Replace with backslashed escape sequences
240+ (only for encoding).}
236241\end {tableii }
237242
243+ The set of allowed values can be extended via \method {register_error}.
244+
238245
239246\subsubsection {Codec Objects \label {codec-objects } }
240247
@@ -303,14 +310,25 @@ \subsubsection{StreamWriter Objects \label{stream-writer-objects}}
303310
304311 The \class {StreamWriter} may implement different error handling
305312 schemes by providing the \var {errors} keyword argument. These
306- parameters are defined :
313+ parameters are predefined :
307314
308315 \begin {itemize }
309316 \item \code {'strict'} Raise \exception {ValueError} (or a subclass);
310317 this is the default.
311318 \item \code {'ignore'} Ignore the character and continue with the next.
312319 \item \code {'replace'} Replace with a suitable replacement character
320+ \item \code {'xmlcharrefreplace'} Replace with the appropriate XML
321+ character reference
322+ \item \code {'backslashreplace'} Replace with backslashed escape sequences.
313323 \end {itemize }
324+
325+ The \var {errors} argument will be assigned to an attribute of the
326+ same name. Assigning to this attribute makes it possible to switch
327+ between different error handling strategies during the lifetime
328+ of the \class {StreamWriter} object.
329+
330+ The set of allowed values for the \var {errors} argument can
331+ be extended with \function {register_error()}.
314332\end {classdesc }
315333
316334\begin {methoddesc }{write}{object}
@@ -360,6 +378,14 @@ \subsubsection{StreamReader Objects \label{stream-reader-objects}}
360378 \item \code {'ignore'} Ignore the character and continue with the next.
361379 \item \code {'replace'} Replace with a suitable replacement character.
362380 \end {itemize }
381+
382+ The \var {errors} argument will be assigned to an attribute of the
383+ same name. Assigning to this attribute makes it possible to switch
384+ between different error handling strategies during the lifetime
385+ of the \class {StreamReader} object.
386+
387+ The set of allowed values for the \var {errors} argument can
388+ be extended with \function {register_error()}.
363389\end {classdesc }
364390
365391\begin {methoddesc }{read}{\optional {size}}
0 commit comments