 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michael Brednich Guest
|
Posted: Fri Jan 14, 2005 8:43 am Post subject: Indy 10 Imap4 umlauts |
|
|
First of all: Please forgive me, I'm not using delphi. However, this
seems to be the right place to ask a question about indy.
When I'm using the IMAP4.Retrieve() method (Indy 10) to retrieve the
body of
a message that contains german umlauts (ö,ä,ü, ...) the returned body
does
eventually not contain the umlaut characters. Instead those characters
are set to '?'.
I've als retrieved the message as raw encoded data. In this data the
umlauts are encoded like this: =C4 or =E4.
OK, I can decode this myself, but it would be much more convinient if
the message class would provide a method to do so. Does anyone know if
there is such a method?
Here's my code (C#):
// create IMAP4 object
IMAP4 imap;
imap = new IMAP4();
// connect to server
imap.AuthType = IMAP4AuthenticationType.atUserPass;
imap.Host = ...
imap.Username = ...
imap.Password = ...
imap.Connect(true);
// open inbox and retrieve message headers
imap.RetrieveOnSelect = RetrieveOnSelect.rsHeaders;
if (imap.SelectMailBox("INBOX"))
{
if (imap.MailBox.MessageList.Count > 0)
{
Message msg = imap.MailBox.MessageList[0];
// retrieve first message (in decoded format)
msg.NoDecode = false;
if (imap.Retrieve(1, msg))
{
// get body
StringCollection body = null;
if (msg.ContentType.IndexOf("multipart") == -1)
{
body = msg.Body;
}
else
{
body = new StringCollection();
foreach(MessagePart mp in msg.MessageParts)
{
if (mp is Text)
{
Text t = (Text)mp;
for (int k = 0; k < t.Body.Count; ++k)
{
body.Add(t.Body[k]);
}
}
}
}
}
}
}
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|