#26802: Sending mails with attachment results in 'bytes' object has no attribute
'encode'
-----------------------------+------------------------------------
     Reporter:  Brandl       |                    Owner:  nobody
         Type:  Bug          |                   Status:  new
    Component:  Core (Mail)  |                  Version:  1.9
     Severity:  Normal       |               Resolution:
     Keywords:               |             Triage Stage:  Accepted
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+------------------------------------

Comment (by claudep):

 The reason we are using `None` instead of `utf-8` as the charset is that
 with `utf-8`, Python will take its default 'utf-8' Charset instance which
 does BASE64 body encoding. And we don't want to use that body encoding, we
 use either Quoted-printable or None at all (that was
 [ececbe77ff573707d8f25084018e66ee07f820fd] and recently
 [836d475afefecd643d5e7f44027d7209df3ac690]).

 We could easily fix this in Python 3.5 by using a real Charset instance
 instead of `'utf-8'`). Python 2.7 is not affected because there is no
 charset sniffing with `encode()`. We are left with Python 3.4, which we
 could special-case and decode the text before passing it to
 `MIMEText.__init__`. I'll suggest a patch.

--
Ticket URL: <https://code.djangoproject.com/ticket/26802#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.41f978b192fa5d77af9a85023cc644b1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to