views:

10

answers:

0

I'm using javamail for imap search by subject on Gmail. I use the subjectTerm class to create a searchTerm object and pass to the search function. Search works fine for subject strings which are pure alphanumeric. As soon as I put in a single quote or a dash in the search string the search fails.

IMAPSSLStore imapSslStore = connectToImap("imap.googlemail.com",993,email,oauthToken,oauthTokenSecret,getAnonymousConsumer(),true);

Folder inbox = imapSslStore.getFolder("[Gmail]/All Mail");
inbox.open(Folder.READ_ONLY);

SearchTerm sTerm = new SubjectTerm("String with quote's and da-sh"); //this fails

Message messages[] = inbox.search(sTerm);  //no results found !

Is there a standard way to escape the search string or this is a limitation on gmail's end?