print(mmime-version content-typetext/plaincharset="us-asciicontent-transfer-encoding bit abc mimetext('abc'_charset='latin- 'print(mmime-version content-typetext/plaincharset="iso- - content-transfer-encodingquoted-printable abc mimetext( 'abc'_charset='utf- 'print(mcontent-typetext/plaincharset="utf- mime-version content-transfer-encodingbase pass text for ascii pass text for latin- but not for 'latin 'ahead pass bytes for utf ywjj this worksbut if you look closelyyou'll notice that we must pass str to the first twobut bytes to the third that requires that we special-case code for unicode types based upon the package' internal operation types other than those expected for unicode encoding don' work at allbecause of newly invalid str/bytes combinations that occur inside the email package in mimetext('abc'_charset='ascii' mimetext( 'abc'_charset='ascii'bugassumes str traceback (most recent call last)lines omitted file " :\python \lib\email\encoders py"line in encode_ or bit orig encode('ascii'attributeerror'bytesobject has no attribute 'encodem mimetext('abc'_charset='latin- ' mimetext( 'abc'_charset='latin- 'bugqp uses str traceback (most recent call last)lines omitted file " :\python \lib\email\quoprimime py"line in body_encode if line endswith(crlf)typeerrorexpected an object with the buffer interface mimetext( 'abc'_charset='utf- ' mimetext('abc'_charset='utf- 'bugbase uses bytes traceback (most recent call last)lines omitted file " :\python \lib\email\base mime py"line in body_encode enc a_base ( [ : max_unencoded]decode("ascii"typeerrormust be bytes or buffernot str moreoverthe email package is pickier about encoding name synonyms than python and most other tools are"latin- is detected as quoted-printable mime typebut client-side scripting