Skip to main content

Module unfold

Module unfold 

Source
Expand description

RFC 5545 §3.1 content line unfolding.

Physical lines longer than 75 octets are folded by inserting a CRLF followed by a single SPACE or HTAB. The reader must reverse this transformation before per-line parsing — the leading folding-marker whitespace is part of the fold, not the value.

Also handles a leading UTF-8 BOM (U+FEFF) tolerantly: many tools (notably Outlook) emit one, and the rest of the parser assumes the input starts at the first wire character.

Functions§

strip_bom
Strip a leading UTF-8 BOM if present.
unfold
Split content into RFC 5545 logical lines.