Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-92081: Fix for email.generator.Generator with whitespace between encoded words. #92281

Merged
merged 2 commits into from
May 20, 2024

Commits on May 20, 2024

  1. Fix for email.generator.Generator with whitespace between encoded words.

    email.generator.Generator currently does not handle whitespace between
    encoded words correctly when the encoded words span multiple lines.  The
    current generator will create an encoded word for each line.  If the end
    of the line happens to correspond with the end real word in the
    plaintext, the generator will place an unencoded space at the start of
    the subsequent lines to represent the whitespace between the plaintext
    words.
    
    A compliant decoder will strip all the whitespace from between two
    encoded words which leads to missing spaces in the round-tripped
    output.
    
    The fix for this is to make sure that whitespace between two encoded
    words ends up inside of one or the other of the encoded words.  This
    fix places the space inside of the second encoded word.
    
    A second problem happens with continuation lines.  A continuation line that
    starts with whitespace and is followed by a non-encoded word is fine because
    the newline between such continuation lines is defined as condensing to
    a single space character.  When the continuation line starts with whitespace
    followed by an encoded word, however, the RFCs specify that the word is run
    together with the encoded word on the previous line.  This is because normal
    words are filded on syntactic breaks by encoded words are not.
    
    The solution to this is to add the whitespace to the start of the encoded word
    on the continuation line.
    
    Test cases are from python#92081
    abadger committed May 20, 2024
    Configuration menu
    Copy the full SHA
    5071b52 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    12e9e11 View commit details
    Browse the repository at this point in the history