This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author flavio
Recipients barry, flavio, r.david.murray
Date 2014-11-27.19:50:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1417117811.17.0.838110994858.issue22666@psf.upfronthosting.co.za>
In-reply-to
Content
Hi, and thank you for your answer.

However this is not strictly related to the newline, but also to some small idiosyncrasies and different behavior among py2 and py3 (and even in py2 using Header() or Charset()):

# py2.7, non-unicode str
>>> H('test', 'utf-8').encode()
'=?utf-8?q?test?='

>>> Charset('utf-8').header_encode('test')
'=?utf-8?q?test?='


# py2.7, unicode str
>>> H(u'test', 'utf-8').encode()   # this is the only different result
'test'

>>> Charset('utf-8').header_encode(u'test')
u'=?utf-8?q?test?='



# py3.4, unicode
>>> H('test', 'utf-8').encode()                                            
'=?utf-8?q?test?='                                                      
                
# py3.4, bytes                                                                
>>> H(b'test', 'utf-8').encode()                                             
'=?utf-8?q?test?='


As you can see, the only when using unicode strings in py2.7 no header encoding is done if the unicode string contains only ascii chars.
History
Date User Action Args
2014-11-27 19:50:11flaviosetrecipients: + flavio, barry, r.david.murray
2014-11-27 19:50:11flaviosetmessageid: <1417117811.17.0.838110994858.issue22666@psf.upfronthosting.co.za>
2014-11-27 19:50:11flaviolinkissue22666 messages
2014-11-27 19:50:11flaviocreate