[gmime-devel] Problems with quoted-printable encoding



I'm having problems with quoted-printable encoding. I'm doing a possible
stupid thing: attaching a binary file (empty .doc document) as a MIME
part using the quoted-printable encoding. The problem is that if the
last byte in the file is binary, it's encoded value is appended without
the '=' character at end of line. The decoder doesn't see '=' at the end
of last line and treats "\r\n" as part of data.

I think the problem is in g_mime_encoding_quoted_encode_close:

if (last != -1) {
            /* space/tab must be encoded if its the last character on
               the line */
            if (is_qpsafe (last) && !is_blank (last)) {
                    *outptr++ = last;
            } else {
                    *outptr++ = '=';
                    *outptr++ = tohex[(last >> 4) & 0xf];
                    *outptr++ = tohex[last & 0xf];
            }
    }

*outptr++ = '\n';

I would insert "=\n" instead of '\n' alone. This fixes my case.

-- 
Damian Pietras


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