[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] pick(1) decode RFC-2047 headers?

From: David Levine
Subject: Re: [Nmh-workers] pick(1) decode RFC-2047 headers?
Date: Sat, 24 Nov 2012 12:26:45 -0600

Ken wrote:

> I'm wondering ... would it make sense to simply have pick run the
> RFC 2047 decoder on headers before matching them?  As far as I can
> tell we can decode all headers except for Received: headers.
> Thoughts?

Definitely.  Though I'm not sure we want to try to decode a
non-MIME header.

I tried the quick proof of concept below and it worked, though it
might not be the best way to do things.  I had originally wanted
to use fmt_compile()/fmt_scan(), but quickly got over that :-/

Unfortunately, there isn't one place we could do this for all
of the programs.  Even within pick, it uses m_getfld() to read
dates for -before/-after but fgets() to read header fields for


diff --git a/uip/picksbr.c b/uip/picksbr.c
index 4895b23..e38a1d8 100644
--- a/uip/picksbr.c
+++ b/uip/picksbr.c
@@ -714,6 +714,15 @@ plist
        p1 = linebuf;
        p2 = n->n_expbuf;
+       if (strstr (p1, "=?")  &&  strstr (p1, "?=")) {
+           /* Proof of concept:  decode a MIME header. */
+           char *decoded = mh_xmalloc (sizeof linebuf);
+           decode_rfc2047 (p1, decoded, sizeof linebuf);
+           strncpy (linebuf, decoded, sizeof linebuf);
+           free (decoded);
+       }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]