Martin Panter added the comment:

Here is a patch that clarifies in the documentation and test suite how newlines 
work in the “quopri” and “binascii” modules. It also fixes the native Python 
implementation to support CRLFs.

* \n is used by default (e.g. for soft line breaks if the input has no hard 
line breaks)
* CRLF is used instead if found in input (even in non-text mode!)
* Typo errors in documentation
* quopri uses istext=True
* header flag does not affect newline encoding; only istext affects it

One corner case concerns me slightly: binascii.b2a_qp(istext=False) will use \n 
for soft line breaks by default, but will suddenly switch to CRLF if the input 
data happens to contain a CRLF sequence. This is despite the CRLFs from the 
data being encoded and therefore not appearing in the output themselves.

----------
assignee:  -> docs@python
components: +Documentation
keywords: +patch
nosy: +docs@python
Added file: http://bugs.python.org/file37756/quopri-newline.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20121>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to