~ubuntu-branches/ubuntu/natty/python3.1/natty-security

« back to all changes in this revision

Viewing changes to Lib/email/encoders.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-07-06 16:52:42 UTC
  • mfrom: (1.2.1 upstream) (2.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20100706165242-2xv4i019r3et6c0j
Tags: 3.1.2+20100706-1ubuntu1
* Merge with Debian; remaining changes:
  - Regenerate the control file.
  - Add debian/patches/overwrite-semaphore-check for Lucid buildds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    Also, add an appropriate Content-Transfer-Encoding header.
30
30
    """
31
31
    orig = msg.get_payload()
32
 
    encdata = _bencode(orig)
 
32
    encdata = str(_bencode(orig), 'ascii')
33
33
    msg.set_payload(encdata)
34
34
    msg['Content-Transfer-Encoding'] = 'base64'
35
35
 
62
62
        # iso-2022-* is non-ASCII but still 7-bit
63
63
        charset = msg.get_charset()
64
64
        output_cset = charset and charset.output_charset
65
 
        if output_cset and output_cset.lower().startswith('iso-2202-'):
 
65
        if output_cset and output_cset.lower().startswith('iso-2022-'):
66
66
            msg['Content-Transfer-Encoding'] = '7bit'
67
67
        else:
68
68
            msg['Content-Transfer-Encoding'] = '8bit'