Skip to content

Conversation

@tisdall
Copy link

@tisdall tisdall commented Dec 5, 2025

rebased replacement of #209

Changes proposed in this pull request

We should fold content to try to keep within 78 characters per line (excluding CRLF). This PR keeps ASCII as ASCII, but folds at foldable whitespace. Also, reworks encoding-words to properly encoding spaces as "_" and to leave foldable space between blocks.

  • restructured encode_header_value:
    • to drop :quoted_printable and accept the header name (to help support folding on first line)
    • if encoding is needed:
      • put into blocks of up to 75 characters with space between to allow folding (previously all the encoding blocks were just put together with no space or CRLF between them)
      • make spaces into _ to prevent folding within an encoded word (and to follow the RFC)
  • do "folding" as a follow-up step as it quickly becomes confusing with email address fields that should be folded after commas and not just on any space
    • currently only does folding on "other" fields that aren't matched by more specific render_header_value/2 functions

I reviewed folding for DKIM headers, and I believe this handles those properly as it also requires folding on "foldable whitespace"

@tisdall tisdall mentioned this pull request Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant