diff options
author | Georg Brandl <georg@python.org> | 2009-05-17 11:28:33 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-05-17 11:28:33 (GMT) |
commit | 3f076d8b3df3a1aa3228bbe993d4f37d577fcc2f (patch) | |
tree | 5af0b00e845c6bad851015467bca470aaeb78c62 /Doc/library/email.charset.rst | |
parent | fe66fc120cfcc10fc38990c6c9c3c8a0b4d585bc (diff) | |
download | cpython-3f076d8b3df3a1aa3228bbe993d4f37d577fcc2f.zip cpython-3f076d8b3df3a1aa3228bbe993d4f37d577fcc2f.tar.gz cpython-3f076d8b3df3a1aa3228bbe993d4f37d577fcc2f.tar.bz2 |
Use new optional argument style in email docs.
Diffstat (limited to 'Doc/library/email.charset.rst')
-rw-r--r-- | Doc/library/email.charset.rst | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/Doc/library/email.charset.rst b/Doc/library/email.charset.rst index 1244615..d4b06fb 100644 --- a/Doc/library/email.charset.rst +++ b/Doc/library/email.charset.rst @@ -14,7 +14,7 @@ Instances of :class:`Charset` are used in several other modules within the Import this class from the :mod:`email.charset` module. -.. class:: Charset([input_charset]) +.. class:: Charset(input_charset=DEFAULT_CHARSET) Map character sets to their email properties. @@ -40,7 +40,6 @@ Import this class from the :mod:`email.charset` module. :class:`Charset` instances have the following data attributes: - .. attribute:: input_charset The initial character set specified. Common aliases are converted to @@ -66,10 +65,10 @@ Import this class from the :mod:`email.charset` module. .. attribute:: output_charset - Some character sets must be converted before they can be used in email headers - or bodies. If the *input_charset* is one of them, this attribute will - contain the name of the character set output will be converted to. Otherwise, it will - be ``None``. + Some character sets must be converted before they can be used in email + headers or bodies. If the *input_charset* is one of them, this attribute + will contain the name of the character set output will be converted to. + Otherwise, it will be ``None``. .. attribute:: input_codec @@ -85,8 +84,8 @@ Import this class from the :mod:`email.charset` module. *output_charset*. If no conversion codec is necessary, this attribute will have the same value as the *input_codec*. - :class:`Charset` instances also have the following methods: + :class:`Charset` instances also have the following methods: .. method:: get_body_encoding() @@ -102,13 +101,9 @@ Import this class from the :mod:`email.charset` module. returns the string ``base64`` if *body_encoding* is ``BASE64``, and returns the string ``7bit`` otherwise. + .. XXX to_splittable and from_splittable are not there anymore! - .. method:: convert(s) - - Convert the string *s* from the *input_codec* to the *output_codec*. - - - .. method:: to_splittable(s) + .. method to_splittable(s) Convert a possibly multibyte string to a safely splittable format. *s* is the string to split. @@ -123,7 +118,7 @@ Import this class from the :mod:`email.charset` module. the Unicode replacement character ``'U+FFFD'``. - .. method:: from_splittable(ustr[, to_output]) + .. method from_splittable(ustr[, to_output]) Convert a splittable string back into an encoded string. *ustr* is a Unicode string to "unsplit". @@ -153,29 +148,17 @@ Import this class from the :mod:`email.charset` module. quoted-printable or base64 encoding. - .. method:: header_encode(s[, convert]) + .. method:: header_encode(string) - Header-encode the string *s*. - - If *convert* is ``True``, the string will be converted from the input - charset to the output charset automatically. This is not useful for - multibyte character sets, which have line length issues (multibyte - characters must be split on a character, not a byte boundary); use the - higher-level :class:`~email.header.Header` class to deal with these issues - (see :mod:`email.header`). *convert* defaults to ``False``. + Header-encode the string *string*. The type of encoding (base64 or quoted-printable) will be based on the *header_encoding* attribute. - .. method:: body_encode(s[, convert]) - - Body-encode the string *s*. + .. method:: body_encode(string) - If *convert* is ``True`` (the default), the string will be converted from - the input charset to output charset automatically. Unlike - :meth:`header_encode`, there are no issues with byte boundaries and - multibyte charsets in email bodies, so this is usually pretty safe. + Body-encode the string *string*. The type of encoding (base64 or quoted-printable) will be based on the *body_encoding* attribute. @@ -205,7 +188,7 @@ The :mod:`email.charset` module also provides the following functions for adding new entries to the global character set, alias, and codec registries: -.. function:: add_charset(charset[, header_enc[, body_enc[, output_charset]]]) +.. function:: add_charset(charset, header_enc=None, body_enc=None, output_charset=None) Add character properties to the global registry. |