• Bug#265350: rss2email: correct subject encoding and body word wrapping

    From Martin Michlmayr@1:229/2 to All on Thu Aug 12 23:00:11 2004
    From: [email protected]

    * Lars Wirzenius <[email protected]> [2004-08-12 23:07]:
    Also, rss2email tends to generate very long text lines for text/plain
    mails.

    Yeah, I find that annoying too.

    The patch also contains a rudimentary word wrapping function,

    Python has a textwrap.wrap()
    --
    Martin Michlmayr
    [email protected]


    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Joey Hess@1:229/2 to Lars Wirzenius on Fri Aug 13 03:10:08 2004
    From: [email protected]

    Lars Wirzenius wrote:
    Perhaps I should separate the subject encoding from this patch so that
    the word wrap tweaking won't hinder applying the subject encoding (which
    is an actual bug).

    Yes, I'd rather address these separatly. I've talked about the wrapping
    with r2e's author before, and he prefers to leave it to the mail client
    to handle the wrapping (which mutt does). It's true that RFC 2646
    specifies that the Content-Type should be 'text/plain; format=flowed',
    and recommends keeping the lines under 80 characters even with flow
    encoded text. I've not followed up on making r2e's use of flowed text
    more RFC compliant since it happens to already work well in mutt and
    some other clients.

    I don't have a test feed handy right now but I think this is the patch
    for the 7-bit subject:

    Index: debian/changelog ===================================================================
    --- debian/changelog (revision 10593)
    +++ debian/changelog (working copy)
    @@ -1,3 +1,10 @@
    +rss2email (1:2.51-6) UNRELEASED; urgency=low
    +
    + * Patch from Lars Wirzenius to properly encode the Subject in 7-bit ascii.
    + Closes: #265350
    +
    + -- Joey Hess <[email protected]> Thu, 12 Aug 2004 21:47:44 -0300
    +
    rss2email (1:2.51-5) unstable; urgency=low

    * sendmail comment typo fix. Closes: #259691
    Index: rss2email.py ===================================================================
    --- rss2email.py (revision 10593)
    +++ rss2email.py (working copy)
    @@ -103,6 +103,8 @@
    if SMTP_SEND: import smtplib; smtpserver = smtplib.SMTP(SMTP_SERVER)
    else: smtpserver = None

    +from email.Header import Header
    +
    import feedparser
    feedparser.USER_AGENT = "rss2email/"+__version__+ " +http://www.aaronsw.com/2002/rss2email/"

    @@ -127,6 +129,10 @@
    """Quote names in email according to RFC822."""
    return '"' + unu(s).replace("\\", "\\\\").replace('"', '\\"') + '"'

    +def header7bit(s):
    + """E
  • From Joey Hess@1:229/2 to Lars Wirzenius on Fri Aug 13 16:40:08 2004
    From: [email protected]

    Lars Wirzenius wrote:
    That should be it, yes. However, I today realized that at least the From header may also need to be encoded. Just to be safe, the To header as
    well.

    Attached is a patch that encodes only those headers and does no word wrapping.

    That looks identical to the last patch actually. Maybe you sent the
    wrong one.

    --
    see shy jo

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.5 (GNU/Linux)

    iD8DBQFBHNAld8HHehbQuO8RAvicAJ4gv9I8e5vKJwL7/gNGwnXxNx11BQCcCnxb 1/BnHdVSSzqCoiL4fs3HSdw=
    =A/2d
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Lars Wirzenius@1:229/2 to All on Fri Aug 13 17:40:10 2004
    From: [email protected]

    pe, 2004-08-13 kello 18:06, Joey Hess kirjoitti:
    Lars Wirzenius wrote:
    Oops. Let me try again...
    "From: " + quote822(getName(r.feed, entry)) + " <"+from_addr+">" +

    I guess maybe you meant to call header7bit(quote822(..)) here?

    I tried that, but it caused more trouble: it seems that the MIME
    encoding is better done before quoting the RFC-822 special characters
    (such as double quotes and commas). I admit I'm rusty on the various
    levels of quoting one has to do with e-mail.

    --
    http://liw.iki.fi/liw/log/


    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Joey Hess@1:229/2 to Lars Wirzenius on Fri Aug 13 17:40:11 2004
    From: [email protected]

    Lars Wirzenius wrote:
    Oops. Let me try again...
    "From: " + quote822(getName(r.feed, entry)) + " <"+from_addr+">" +

    I guess maybe you meant to call header7bit(quote822(..)) here?

    --
    see shy jo

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.5 (GNU/Linux)

    iD8DBQFBHNkQd8HHehbQuO8RAqtEAJ9Ft1N39R779nU+P7tdQRbsqu6/QgCeNGPY PWPptHrpSv5Y/jGCR+b5BSc=
    =nJcZ
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Joey Hess@1:229/2 to Lars Wirzenius on Fri Aug 13 21:00:19 2004
    From: [email protected]

    Lars Wirzenius wrote:
    pe, 2004-08-13 kello 18:06, Joey Hess kirjoitti:
    Lars Wirzenius wrote:
    Oops. Let me try again...
    "From: " + quote822(getName(r.feed, entry)) + " <"+from_addr+">" +

    I guess maybe you meant to call header7bit(quote822(..)) here?

    I tried that, but it caused more trouble: it seems that the MIME
    encoding is better done before quoting the RFC-822 special characters
    (such as double quotes and commas). I admit I'm rusty on the various
    levels of quoting one has to do with e-mail.

    But as far as I can see, the patch doesn't encode the name in the From at
    all, and you did say you had added something to do it. Is my python so
    bad that I'm not seeing where you encode the feed name, or did that turn
    out to be entirely a bad idea?

    --
    see shy jo

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.5 (GNU/Linux)

    iD8DBQFBHPLTd8HHehbQuO8RAiybAJsHRcDHuByT1XTJAyMqs05bKcp1OgCfVOsb fCdywtMQ15m3VfhrDp2gTY0=
    =TTxB
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Lars Wirzenius@1:229/2 to All on Sat Aug 14 00:40:07 2004
    From: [email protected]

    pe, 2004-08-13 kello 19:56, Joey Hess kirjoitti:
    But as far as I can see, the patch doesn't encode the name in the From at all, and you did say you had added something to do it. Is my python so
    bad that I'm not seeing where you encode the feed name, or did that turn
    out to be entirely a bad idea?

    Er, yes, you are quite right. I experimented with several variants and
    seem to have made the diff against the wrong one. I am an idiot. I
    should try to avoid doing things in a hurry. I'll make a new patch when
    I've sobered up and had a good night's sleep. Sorry to waste your time.

    --
    http://liw.iki.fi/liw/log/


    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)