set_charset(charset)
Set the character set of the payload to charset, which can either be a Charset
instance (see email.charset
), a string naming a character set, or None
. If it is a string, it will be converted to a Charset
instance. If charset is None
, the charset
parameter will be removed from the Content-Type header (the message will not be otherwise modified). Anything else will generate a TypeError
.
If there is no existing MIME-Version header one will be added. If there is no existing Content-Type header, one will be added with a value of text/plain. Whether the Content-Type header already exists or not, its charset
parameter will be set to charset.output_charset. If charset.input_charset and charset.output_charset differ, the payload will be re-encoded to the output_charset. If there is no existing Content-Transfer-Encoding header, then the payload will be transfer-encoded, if needed, using the specified Charset
, and a header with the appropriate value will be added. If a Content-Transfer-Encoding header already exists, the payload is assumed to already be correctly encoded using that Content-Transfer-Encoding and is not modified.
Please login to continue.