Discussion:
IdMessage Subject not decoding correctly?
(too old to reply)
Andrew
2007-06-18 09:32:24 UTC
Permalink
Hi All,

I am using Indy 9.00.10 with D7 and am writing a small app to download
messages from a mail server. If i recieve a message sent with outlook, then
everything behaves just fine. If i recieve a message that was sent via MMS
then the subject line looks like this : "?utf-8?b?IDIxMDMyMTgwNjA3?=", but
if i save the message as a .eml file and open it with outlook express, it
shows me the correct subject "21032180607".

Any ideas?

TIA
Remy Lebeau (TeamB)
2007-06-18 16:40:45 UTC
Permalink
Post by Andrew
I am using Indy 9.00.10
That is a very old version of Indy. You should consider upgrading to
at least the current 9.0.50 snapshot.
Post by Andrew
If i recieve a message that was sent via MMS then the subject
line looks like this : "?utf-8?b?IDIxMDMyMTgwNjA3?="
That is perfectly normal. The original MMS message was Unicode and
had to be encoded in order to be transmitted through the Ansi-based
email system. However, Indy (9 or 10, doesn't matter) does not
support UTF-8 right now, so it will not automatically decode such a
subject. You will have to decode it manually. The encoding begins
with "=?" and ends with "?=" and has three "?"-delimited sections in
between: the encoding type, the transfer type, and the actual data.
In this case, the transfer type is "b", which stands for base64. So
you must first decode the base64 that is provided (you can use the
TIdDecoderMIME class for that), and then you can decode the resulting
UTF-8 data (the VCL has a UTF8Decode() function for that) to obtain
the original Unicode text.
Post by Andrew
if i save the message as a .eml file and open it with outlook
express, it shows me the correct subject "21032180607".
Because OE does support UTF-8 and can fully decode it.


Gambit
Andrew
2007-06-19 06:34:16 UTC
Permalink
Thanks Remy!
Post by Remy Lebeau (TeamB)
Post by Andrew
I am using Indy 9.00.10
That is a very old version of Indy. You should consider upgrading to
at least the current 9.0.50 snapshot.
Post by Andrew
If i recieve a message that was sent via MMS then the subject
line looks like this : "?utf-8?b?IDIxMDMyMTgwNjA3?="
That is perfectly normal. The original MMS message was Unicode and
had to be encoded in order to be transmitted through the Ansi-based
email system. However, Indy (9 or 10, doesn't matter) does not
support UTF-8 right now, so it will not automatically decode such a
subject. You will have to decode it manually. The encoding begins
with "=?" and ends with "?=" and has three "?"-delimited sections in
between: the encoding type, the transfer type, and the actual data.
In this case, the transfer type is "b", which stands for base64. So
you must first decode the base64 that is provided (you can use the
TIdDecoderMIME class for that), and then you can decode the resulting
UTF-8 data (the VCL has a UTF8Decode() function for that) to obtain
the original Unicode text.
Post by Andrew
if i save the message as a .eml file and open it with outlook
express, it shows me the correct subject "21032180607".
Because OE does support UTF-8 and can fully decode it.
Gambit
Loading...