Archived Forum Post

Index of archived forum posts


failed to display 8bit encoded email

Apr 06 '15 at 21:44

I tried now for 2 days and a few month before another few days. Now I have no more ideas. I trust, that you guys can help me out!

I receive emails with ChilkatEmail2

Dim eMail As ChilkatEmail2
Set eMail = bundle.GetEmail(i)
myMail = eMail.GetMime

and it works, but not for mails that are 8bit encoded.

I have 3 Testmails that contains same text with german vowels ü and ä:

1st: --------------010305030209020706010509
Content-Type: Text/Plain;
Content-Transfer-Encoding: Quoted-Printable

iso-8859-1,qp: B=FCcher =E4ndern

2nd: --------------010305030209020706010509
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

utf8,8bit: Bücher ändern

3rd: --------------010305030209020706010509
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

utf8,qp: B=C3=BCcher =C3=A4ndern

In Thunderbird the content is displayed properly as in the 2nd with utf-8, 8bit.

But when I receive the mails with vb6/chilkat, they come in like this:

So, 1 and 3 are as expected, but 3 is wrong. VB6 can not handle unicode, but can handle ä,ö,ü as used in german nad other languages. So how to bring #2 to: utf8,8bit: Bücher ändern

My idea was to convert it after parsing. So I made this function:

Public Function DecodeMimeString(ByVal SourceData As String, ByVal Encoding As String, Optional ByVal charset As String) As String
    Dim crypt As New ChilkatCrypt2
    crypt.UnlockComponent ("hereismykey")
    crypt.CryptAlgorithm = "none"
    crypt.EncodingMode = Encoding
    crypt.charset = charset
    DecodeMimeString = crypt.DecryptStringENC(SourceData)
End Function

I pass iso-8859-1/utf-8 as charset to the function, and quoted-printable/8bit as encoding to the function. it works fine for quoted-printable, but #2 with 8bit result in this string: '^w^' instead of 'Bücher ändern'

So, now I really hope that you can give me good hints. I appreciate that very much. Pete


Make sure to test with the latest version of Chilkat.

If the MIME string returned by eMail.GetMime displays "Bücher ändern", then the problem has already occurred and won't be fixed by a further attempt to "decode".