+ 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)
| 334 | return self._fold(name, value, sanitize=True) |
| 335 | |
| 336 | def fold_binary(self, name, value): |
| 337 | """+ |
| 338 | Headers are folded using the Header folding algorithm, which preserves |
| 339 | existing line breaks in the value, and wraps each resulting line to the |
| 340 | max_line_length. If cte_type is 7bit, non-ascii binary data is CTE |
| 341 | encoded using the unknown-8bit charset. Otherwise the original source |
| 342 | header is used, with its existing line breaks and/or binary data. |
| 343 | |
| 344 | """ |
| 345 | folded = self._fold(name, value, sanitize=self.cte_type=='7bit') |
| 346 | return folded.encode('ascii', 'surrogateescape') |
| 347 | |
| 348 | def _fold(self, name, value, sanitize): |
| 349 | parts = [] |