diff options
author | Fred Drake <fdrake@acm.org> | 2001-05-15 15:27:53 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-05-15 15:27:53 (GMT) |
commit | c0dac1a58c894dc6b8866bb23df58878b12365df (patch) | |
tree | 165ef1862e54891cf9ddd24ebcecfa6fcdd8753f /Doc | |
parent | da05e977f3a85519805314ad8a7ebe4b944e13d4 (diff) | |
download | cpython-c0dac1a58c894dc6b8866bb23df58878b12365df.zip cpython-c0dac1a58c894dc6b8866bb23df58878b12365df.tar.gz cpython-c0dac1a58c894dc6b8866bb23df58878b12365df.tar.bz2 |
Beef up the unicode() description a bit, based on material from AMK's
"What's New in Python ..." documents.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libfuncs.tex | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index 42b3497..58039dd 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -688,10 +688,18 @@ strings. The argument must be in the range [0..65535], inclusive. \end{funcdesc} \begin{funcdesc}{unicode}{string\optional{, encoding\optional{, errors}}} -Decodes \var{string} using the codec for \var{encoding}. Error -handling is done according to \var{errors}. The default behavior is -to decode UTF-8 in strict mode, meaning that encoding errors raise -\exception{ValueError}. See also the \refmodule{codecs} module. +Create a Unicode string from an 8-bit string \var{string} using the +codec for \var{encoding}. The \var{encoding} parameter is a string +giving the name of an encoding. Error handling is done according to +\var{errors}; this specifies the treatment of characters which are +invalid in the input encoding. If \var{errors} is \code{'strict'} +(the default), a \exception{ValueError} is raised on errors, while a +value of \code{'ignore'} causes errors to be silently ignored, and a +value of \code{'replace'} causes the official Unicode replacement +character, \code{U+FFFD}, to be used to replace input characters which +cannot be decoded. The default behavior is to decode UTF-8 in strict +mode, meaning that encoding errors raise \exception{ValueError}. See +also the \refmodule{codecs} module. \versionadded{2.0} \end{funcdesc} |