Archived Forum Post

Index of archived forum posts

Question:

Unsupported Charset Error in IMAP Search Response?

Oct 16 '12 at 11:41

I get this error when trying to search for emails on the Yahoo IMAP server:

    connectedTo: imap.mail.yahoo.com
    selectedMailbox: Trash
    bUid: 0
    command: aaae SEARCH CHARSET ISO-8859-1 SUBJECT "blah รจรจรจ blah blah"
    imapResponse2: aaae NO [CANNOT] SEARCH error - Unsupported charset ISO-8859-1


Answer

The current behavior of the Chilkat IMAP class is to specify a multibyte charset in the SEARCH command if the search criteria includes chars that are not 7bit (i.e. not us-ascii). If 8bit chars are found, then the criteria string is analyzed and an appropriate charset is chosen based on the language of chars found (such as Russian, Greek, Hebrew, Arabic, Chinese, etc.)

Chilkat is adding a new IMAP property in v9.3.3 named "SearchCharset", which will default to "UTF-8" so that UTF-8 will always be chosen if 8bit chars are found. (If no 8bit chars are found, then no charset is specified in the SEARCH command and there is no issue.) The SearchCharset property can be set to "AUTO" to get the old behavior. (Or it can be explicitly set to any multibyte charset name, such as "WINDOWS-1252" if desired.