+ Headers are folded using the Header folding algorithm, which preserves existing line breaks in the value, and wraps each resulting line to the max_line_length. If cte_type is 7bit, non-ascii binary data is CTE encoded using the unknown-8bit charset. Otherwise the
(self, name, value)
| 344 | return self._fold(name, value, sanitize=True) |
| 345 | |
| 346 | def fold_binary(self, name, value): |
| 347 | """+ |
| 348 | Headers are folded using the Header folding algorithm, which preserves |
| 349 | existing line breaks in the value, and wraps each resulting line to the |
| 350 | max_line_length. If cte_type is 7bit, non-ascii binary data is CTE |
| 351 | encoded using the unknown-8bit charset. Otherwise the original source |
| 352 | header is used, with its existing line breaks and/or binary data. |
| 353 | |
| 354 | """ |
| 355 | folded = self._fold(name, value, sanitize=self.cte_type=='7bit') |
| 356 | return folded.encode('ascii', 'surrogateescape') |
| 357 | |
| 358 | def _fold(self, name, value, sanitize): |
| 359 | parts = [] |