Archived Forum Post

Index of archived forum posts


i have problem about imap get email and charset

Jun 30 '16 at 08:27

hi chilkatsoft

i have one problem.

when i get message form imap server (Gmail) only TEXT RECEIVE language THAI is "?????????".

i think maybe it is problem about CHARSET but i can't change charset before get message.

can you help me?

thank you very much!

Accepted Answer

This new build should solve the problem:

The Chilkat objects (in Java) should all automatically return utf-8 strings.


OK i can solve a problem!!

CkMessageSet messageSet;
boolean fetchUids = true;
messageSet = imap.Search("ALL", fetchUids);

// Fetch EMAIL
CkEmailBundle bundle;
bundle = imap.FetchBundle(messageSet);

// Loop Get EMAIL Data
for (int i = 0; i <= bundle.get_MessageCount() - 1; i++) {

    CkEmail email = new CkEmail();
    email = bundle.GetEmail(i);

    String FROM = email.fromAddress();

    CkString to = new CkString();
    email.GetToAddr( 0, to );
    String TO = to.getString();

    CkByteData email_subject = new CkByteData();
    email.GetMbHeaderField2( "utf-8", "Subject", email_subject );
    String SUBJECT = email_subject.to_s();

    CkByteData email_body = new CkByteData();
    String BODY = email_body.to_s();



Thanks! I think I see the cause of the original problem. The Chilkat objects in Java should always return utf-8 strings. This is the case for objects created via the "new" operator. However, for objects returned by another Chilkat method, such as bundle.GetEmail, the methods are not returning utf-8. This is something that can be fixed. I will work on this tomorrow and if you wish, will point you to a new build. (What operating system do you use?)


Thank you for new build.



hello i have same problems with that i have so many language and my application is on php so what is the issue

please let me know ASAP.