This seems to be part of the code move from nmh. Philipp took the QP code but not (yet) the base64 code for RFC 2047 encoding of header fields. That's the reason why we have this outcommented code.
Actually, I think that we don't need base64 encoding of header fields. The only reason for it is that it usually leads to shorter headers if you encode mostly non-ASCII values. I don't really care if the encoded header is 50, 100, or 400 chars long. As long as we don't drop into problems here, I'd like to save the additional code and stay with the simple solution of only supporting one RFC 2047 encoding. Thus apply the proposed patch. Philipp? btw: Patch #6 should be part of this patch. meillo [2016-09-08 13:03] [email protected] > > From: Dmitry Bogatov <[email protected]> > > --- > sbr/encode_rfc2047.c | 36 ------------------------------------ > 1 file changed, 36 deletions(-) > > diff --git a/sbr/encode_rfc2047.c b/sbr/encode_rfc2047.c > index 3c4a6b0..00310b3 100644 > --- a/sbr/encode_rfc2047.c > +++ b/sbr/encode_rfc2047.c > @@ -58,7 +58,6 @@ static int field_encode_quoted(const char *, char **, const > char *, int, > int, int); > static int scanstring(const char *, int *, int *, int *); > static int utf8len(const char *); > -/*static int pref_encoding(int, int, int);*/ > > /* > ** Encode a message header using RFC 2047 encoding. We make the assumption > @@ -633,38 +632,3 @@ scanstring(const char *string, int *asciilen, int > *eightbitchars, > > return *eightbitchars > 0; > } > - > -#if 0 > - > -/* > -** This function is to be used to decide which encoding algorithm we should > -** use if one is not given. Basically, we pick whichever one is the shorter > -** of the two. > -** > -** Arguments are: > -** > -** ascii - Number of ASCII characters in to-be-encoded string. > -** specials - Number of ASCII characters in to-be-encoded string that > -** still require encoding under quoted-printable. Note that > -** these are included in the "ascii" total. > -** eightbit - Eight-bit characters in the to-be-encoded string. > -** > -** Returns one of CE_BASE64 or CE_QUOTED. > -**/ > -static int > -pref_encoding(int ascii, int specials, int eightbits) > -{ > - /* > - ** The length of the q-p encoding is: > - ** > - ** ascii - specials + (specials + eightbits) * 3. > - ** > - ** The length of the base64 encoding is: > - ** > - ** base64len(ascii + eightbits) (See macro for details) > - */ > - return base64len(ascii + eightbits) < (ascii - specials + > - (specials + eightbits) * 3) ? CE_BASE64 : CE_QUOTED; > -} > - > -#endif > -- > I may be not subscribed. Please, keep me in carbon copy. > > >
