bug-mailutils
[Top][All Lists]
Advanced

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

Re: [bug-mailutils] Bug: Content-Transfer-Encoding: quoted-printable


From: Sergey Poznyakoff
Subject: Re: [bug-mailutils] Bug: Content-Transfer-Encoding: quoted-printable
Date: Sun, 14 May 2006 18:22:09 EEST

Alastair Poole <address@hidden> wrote:

> Basically, mu_message_get_body(msg, &body); mu_body_get_stream(body,
> &stream); mu_stream_read(stream, buf, sizeof(buf) 0, &ret);  

That's wrong. The stream obtained by mu_body_get_stream returns all
characters as they appear in the body -- it does not attept to decode or
to convert anything. If you wish to decode the stream, create a
decoder stream and give it the body stream as its input. Reading from
the decoder stream will return decoded characters (of course, provided
that you select the right type of the stream - eg. base64
vs. quoted-printable and vice versa). Another note is that you cannot
simply get an arbitrary body stream and feed it into a decoder, since
the message might be plain text. In general, you should first check if
the message is a multy-part one. If so, calling mu_message_get_part will
give you the desired part of the message.  Then, by analysing its
headers you can deduce the encoding type and charset. Finally, using
these data, you create an appropriate decoding stream and decode the
message part in question.

Please see examples/base64.c and examples/decode2047.c for simple
examples on using decoding streams.

Please see mail/decode.c and mh/mhn.c for examples on how to handle multipart
messages and encoded headers.

Regards,
Sergey




reply via email to

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