Archived Forum Post

Index of archived forum posts

Question:

To address changing encoding

Aug 03 '15 at 22:42

Hello,

we are using the Chilkat.NET IMAP library v9.5.0.51 to fetch emails from a mail server. Most of the time, this works fine. For some mails, however, the "To" address changes encoding, and the returned string contains the actual mime encoded string. The mail header I see using a different tool is:

To: =?iso-8859-1?Q?VL_Auftr=E4ge?= <VLAuftraege@example.com>, OAM <OAM@example.com>, "OAM Reservierungen" <dispo@example.com>

When using the EmailBundle.GetEmail(int).GetTo(int) method, the values retrieved are:

As you can see, the first address' encoding is changed from iso-8859-1 to UTF-8, and it is returned as a mime encoded string, not as a decoded .NET string. Is this a bug in your library or are we using it wrongly?

Thanks for your help and kind regards,

Christoph

====

UPDATE:

This seems to be an issue, that was introduced with a new version of the library. Before, we were using v9.5.0.39 and everything seems to be fine in our database. We upgraded due to instabilities in the older version:

System.AccessViolationException Stack: at <Module>.ClsImap.FetchBundle(ClsImap, ClsMessageSet, ProgressEvent*) at Chilkat.Imap.FetchBundle(Chilkat.MessageSet)

==

UPDATE 2:

This also applies to the Cc addresses.


Answer

We have implemented a workaround for this. It seems that Email.GetToAddr(int) and Email.GetToName(int) and the corresponding Email.GetCcAddr(int) and Email.GetCcName(int) methods deliver the decoded data correctly. So, we now store the email address as:

MailAddress ma = new MailAddress(email.GetToAddr(i), email.GetToName(i)); to = ma.ToString();

An actual bugfix, or an information that this is the intended behavior of the library, and the "workaround" is the way to use the library is greatly appreciated :-)

Thanks again,

Christoph


Answer

This new .NET build should fix it:

32-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatDotNet45-9.5.0-win32.zip
64-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatDotNet45-9.5.0-x64.zip

(This is the build for the .NET 4.5 Framework. If you need something else, please let me know..)