How to get MAILMIME_DISCRETE_TYPE_TEXT in UTF-8?

"Stanislaw T. Findeisen" <[email protected]> Mon, 12 Nov 2007 16:02:08 +0100
Newsgroups gmane.mail.libetpan.user
Message-ID <[email protected]>
Hello,

I want to parse MIME message and read texts stored in its 
MAILMIME_DISCRETE_TYPE_TEXT subparts.

I think I already know how to find those parts --- so this is not a 
problem. The question is how to read the texts when I already got a 
pointer to this structure:

     struct mailmime_data {
         int dt_type;
         int dt_encoding;
         int dt_encoded;
         union {
             struct {
                 const char * dt_data;
                 size_t dt_length;
             } dt_text;
             char * dt_filename;
         } dt_data;
     };

The questions are:

(1) In case of MAILMIME_DISCRETE_TYPE_TEXT, is dt_data a 0-terminated 
string of length equal to dt_length?
(2) How to get the text (dt_data) DECODED, namely in UTF-8? Are there 
any helper functions for this?
(3) What are the usage scenarios when dt_type can be MAILMIME_DATA_FILE?

Thanks!

STF

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/