Fix encode/decode method doc of str, bytes, bytearray types

* Specify the default encoding: write 'utf-8' instead of
   sys.getdefaultencoding(), because the default encoding is now constant
 * Specify the default errors value
This commit is contained in:
Victor Stinner 2010-11-07 18:41:46 +00:00
parent 64bc3b28a3
commit e14e212221
4 changed files with 18 additions and 18 deletions

View file

@ -2465,10 +2465,10 @@ bytearray_rstrip(PyByteArrayObject *self, PyObject *args)
}
PyDoc_STRVAR(decode_doc,
"B.decode([encoding[, errors]]) -> str\n\
"B.decode([encoding='utf-8'[, errors='strict']]) -> str\n\
\n\
Decode B using the codec registered for encoding. encoding defaults\n\
to the default encoding. errors may be given to set a different error\n\
Decode B using the codec registered for encoding. Default encoding\n\
is 'utf-8'. errors may be given to set a different error\n\
handling scheme. Default is 'strict' meaning that encoding errors raise\n\
a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\
as well as any other name registered with codecs.register_error that is\n\

View file

@ -2289,10 +2289,10 @@ bytes_endswith(PyBytesObject *self, PyObject *args)
PyDoc_STRVAR(decode__doc__,
"B.decode([encoding[, errors]]) -> str\n\
"B.decode([encoding='utf-8'[, errors='strict']]) -> str\n\
\n\
Decode B using the codec registered for encoding. encoding defaults\n\
to the default encoding. errors may be given to set a different error\n\
Decode B using the codec registered for encoding. Default encoding\n\
is 'utf-8'. errors may be given to set a different error\n\
handling scheme. Default is 'strict' meaning that encoding errors raise\n\
a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\
as well as any other name registerd with codecs.register_error that is\n\

View file

@ -7393,10 +7393,10 @@ unicode_count(PyUnicodeObject *self, PyObject *args)
}
PyDoc_STRVAR(encode__doc__,
"S.encode([encoding[, errors]]) -> bytes\n\
"S.encode([encoding='utf-8'[, errors='strict']]) -> bytes\n\
\n\
Encode S using the codec registered for encoding. encoding defaults\n\
to the default encoding. errors may be given to set a different error\n\
Encode S using the codec registered for encoding. Default encoding\n\
is 'utf-8'. errors may be given to set a different error\n\
handling scheme. Default is 'strict' meaning that encoding errors raise\n\
a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n\
'xmlcharrefreplace' as well as any other name registered with\n\