Subject: How to encode a header (subject) (RFC1522 encoding) with c-client

From: Pekka Karp <[email-masked]>
Date: Fri, 20 Sep 2002 09:02:31 +0300

Hello,
    can anyone help me and please tell me how to
encode subject on header before a new
    message sending.  (RFC1522 encoding) with
c-client functions.

-Pekka Karp

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Vadim Zeitlin <[email-masked]>
Date: Fri, 20 Sep 2002 14:18:46 +0200 (CET)

On Fri, 20 Sep 2002 09:02:31 +0300 Pekka Karp <[email-masked]> wrote:

PK> can anyone help me and please tell me how to encode subject on header
PK> before a new message sending.  (RFC1522 encoding) with c-client
PK> functions.

 I use either rfc822_binary() or rfc822_8bit() depending on the number of
characters needed to be encoded. You have to be careful about a few things
however:

1. the encoded words (in the sense of RFC 2047) must be no more than 75
   characters and you have to enforce this yourself

2. rfc822_8bit() doesn't encode spaces, tabs and '?' which must be encoded
   in the header so you need to do this manually

 I don't know why c-client doesn't provide a standard function to do this.
I think I've already asked Mark (if I'm mistaken, let me do it now) if a
patch adding such function would be accepted -- if this is the case, I may
provide one.

 Regards,
VZ

---

From: Mark Crispin <[email-masked]>
Date: Fri, 20 Sep 2002 09:53:24 -0700 (PDT)

The main reasons why c-client does not have any MIME2 encoding routines (it
does have a routine to decode MIME2 to UTF-8) are:
 . it's easy enough to do in the application
 . there's no obvious place where it would fit without breaking existing
    applications

To clarify the latter, the ENVELOPE structure (which is where data that would
be MIME2 encoded would go) only stores ASCII strings.  There's no concept of
"charset" in the ENVELOPE structure, and no obvious way to add it without
breaking existing applications.