Message229640
When trying to encode an email header with a newline in it, correct encoding is done only for strings and not for unicode strings.
In fact, for unicode strings, encoding is only done if a non ascii character is contained in it.
The attached patch should fix the problem.
Simple example to reproduce the problem:
>>> from email.Header import Header as H
# correctly encoded
>>> H('two\r\nlines', 'utf-8').encode()
'=?utf-8?q?two=0D=0Alines?='
# unicode string not encoded
>>> H(u'two\r\nlines', 'utf-8').encode()
'two\r\nlines'
# unicode string with non ascii chars, correctly encoded
>>> H(u'two\r\nlines and \xe0', 'utf-8').encode()
'=?utf-8?b?dHdvDQpsaW5lcyBhbmQgw6A=?=' |
|
Date |
User |
Action |
Args |
2014-10-18 13:08:05 | flavio | set | recipients:
+ flavio, barry, r.david.murray |
2014-10-18 13:08:05 | flavio | set | messageid: <1413637685.41.0.262065905558.issue22666@psf.upfronthosting.co.za> |
2014-10-18 13:08:05 | flavio | link | issue22666 messages |
2014-10-18 13:08:05 | flavio | create | |
|